From 29842bb5e46b75607c3144dc82e05af746ab7a35 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Wed, 15 Feb 2017 13:07:34 +0100 Subject: [PATCH] netdev2: rename to netdev and remove `gnrc_netdev` With some minor hand-edits I used the following chain of commands: ```sh git rm sys/include/net/gnrc/netdev.h git grep --name-only -i netdev2 | \ xargs sed -i -e 's/^\(NETDEV\)2\(.*\)\( [("]\)/\1\2 \3/g' \ -e 's/\(netdev\)2\(.*\)\( \/\*\*<\)/\1\2 \3/I' \ -e 's/\(netdev\)2/\1/gI' git add -p git commit --amend git ls-tree --full-tree -r HEAD --name-only | \ grep "netdev2" | xargs -I'{}' dirname '{}' | uniq | \ grep "netdev2" | while read dir; do new_dir="$(echo "$dir" | sed "s/netdev2/netdev/g")" git mv -f "$dir" "$new_dir" done git commit --amend git ls-tree --full-tree -r HEAD --name-only | \ grep "netdev2" | while read file; do new_file="$(echo "$file" | sed "s/netdev2/netdev/g")" git mv -f "$file" "$new_file" done git commit --amend git grep --name-only "\" | \ xargs sed -i "s/\/drivers_netdev_api/g" git add -p git commit --amend ``` --- Makefile.dep | 14 +- README.md | 2 +- boards/cc2538dk/Makefile.dep | 4 +- boards/native/Makefile.dep | 2 +- boards/openmote-cc2538/Makefile.dep | 4 +- boards/remote-common/Makefile.dep | 4 +- cpu/cc2538/include/cc2538_rf.h | 8 +- cpu/cc2538/include/cc2538_rf_netdev.h | 4 +- cpu/cc2538/radio/cc2538_rf.c | 2 +- cpu/cc2538/radio/cc2538_rf_netdev.c | 64 ++-- cpu/native/Makefile | 4 +- cpu/native/README.md | 2 +- .../include/{netdev2_tap.h => netdev_tap.h} | 26 +- ...tdev2_tap_params.h => netdev_tap_params.h} | 22 +- cpu/native/native_cpu.c | 6 +- .../{netdev2_tap => netdev_tap}/Makefile | 0 .../netdev2_tap.c => netdev_tap/netdev_tap.c} | 88 ++--- cpu/native/startup.c | 20 +- cpu/nrf5x_common/include/nrfmin.h | 8 +- cpu/nrf5x_common/include/nrfmin_gnrc.h | 2 +- cpu/nrf5x_common/radio/nrfmin/nrfmin.c | 26 +- cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c | 16 +- dist/tools/ethos/README.md | 2 +- doc/doxygen/src/getting-started.md | 2 +- doc/doxygen/src/riot-gnrc.svg | 24 +- doc/doxygen/src/riot-structure.svg | 6 +- drivers/Makefile.dep | 36 +- drivers/at86rf2xx/at86rf2xx.c | 6 +- drivers/at86rf2xx/at86rf2xx_netdev.c | 60 ++-- drivers/at86rf2xx/include/at86rf2xx_netdev.h | 4 +- .../{cc110x-netdev2.c => cc110x-netdev.c} | 72 ++-- ..._netdev2_cc110x.c => gnrc_netdev_cc110x.c} | 38 +-- .../{cc110x-netdev2.h => cc110x-netdev.h} | 24 +- ..._netdev2_cc110x.h => gnrc_netdev_cc110x.h} | 8 +- drivers/cc2420/cc2420.c | 2 +- drivers/cc2420/cc2420_netdev.c | 40 +-- drivers/cc2420/include/cc2420_netdev.h | 4 +- drivers/enc28j60/enc28j60.c | 34 +- drivers/encx24j600/encx24j600.c | 50 +-- drivers/ethos/ethos.c | 34 +- drivers/include/at86rf2xx.h | 16 +- drivers/include/cc2420.h | 6 +- drivers/include/enc28j60.h | 6 +- drivers/include/encx24j600.h | 8 +- drivers/include/ethos.h | 8 +- drivers/include/kw2xrf.h | 16 +- drivers/include/mrf24j40.h | 8 +- drivers/include/net/{netdev2.h => netdev.h} | 94 +++--- drivers/include/net/{netdev2 => netdev}/eth.h | 22 +- .../net/{netdev2 => netdev}/ieee802154.h | 78 ++--- drivers/include/w5100.h | 8 +- drivers/include/xbee.h | 8 +- drivers/kw2xrf/include/kw2xrf_netdev.h | 2 +- drivers/kw2xrf/kw2xrf.c | 2 +- drivers/kw2xrf/kw2xrf_netdev.c | 78 ++--- drivers/mrf24j40/include/mrf24j40_netdev.h | 4 +- drivers/mrf24j40/mrf24j40.c | 12 +- drivers/mrf24j40/mrf24j40_getset.c | 6 +- drivers/mrf24j40/mrf24j40_netdev.c | 64 ++-- drivers/{netdev2_eth => netdev_eth}/Makefile | 0 .../netdev2_eth.c => netdev_eth/netdev_eth.c} | 14 +- .../Makefile | 0 .../netdev_ieee802154.c} | 32 +- drivers/w5100/w5100.c | 28 +- drivers/xbee/xbee.c | 20 +- examples/gnrc_border_router/Makefile | 2 +- examples/gnrc_border_router/README.md | 2 +- pkg/emb6/Makefile.dep | 2 +- pkg/emb6/Makefile.include | 4 +- pkg/emb6/contrib/board_conf.c | 4 +- pkg/emb6/contrib/{netdev2 => netdev}/Makefile | 2 +- .../emb6_netdev2.c => netdev/emb6_netdev.c} | 88 ++--- pkg/emb6/contrib/target.c | 2 +- pkg/emb6/include/emb6/{netdev2.h => netdev.h} | 14 +- pkg/lwip/Makefile.include | 4 +- pkg/lwip/contrib/lwip.c | 32 +- .../lwip/contrib/netdev}/Makefile | 2 +- .../lwip_netdev2.c => netdev/lwip_netdev.c} | 74 ++--- .../lwip/netif/{netdev2.h => netdev.h} | 26 +- .../src/gnrc_nordic_ble_6lowpan.c | 2 +- release-notes.txt | 16 +- sys/Makefile | 8 +- sys/auto_init/auto_init.c | 6 +- sys/auto_init/netif/auto_init_at86rf2xx.c | 22 +- sys/auto_init/netif/auto_init_cc110x.c | 18 +- sys/auto_init/netif/auto_init_cc2420.c | 20 +- sys/auto_init/netif/auto_init_cc2538_rf.c | 22 +- sys/auto_init/netif/auto_init_enc28j60.c | 20 +- sys/auto_init/netif/auto_init_encx24j600.c | 24 +- sys/auto_init/netif/auto_init_ethos.c | 22 +- sys/auto_init/netif/auto_init_kw2xrf.c | 14 +- sys/auto_init/netif/auto_init_mrf24j40.c | 22 +- sys/auto_init/netif/auto_init_netdev2_tap.c | 54 --- sys/auto_init/netif/auto_init_netdev_tap.c | 54 +++ sys/auto_init/netif/auto_init_slip.c | 4 +- sys/auto_init/netif/auto_init_w5100.c | 18 +- sys/auto_init/netif/auto_init_xbee.c | 10 +- sys/include/net/csma_sender.h | 6 +- sys/include/net/gnrc.h | 7 +- sys/include/net/gnrc/mac/internal.h | 10 +- sys/include/net/gnrc/netdev.h | 313 ++++++++++-------- .../net/gnrc/{netdev2 => netdev}/eth.h | 20 +- sys/include/net/gnrc/netdev/ieee802154.h | 46 +++ .../net/gnrc/{netdev2 => netdev}/xbee_adpt.h | 18 +- sys/include/net/gnrc/netdev2.h | 226 ------------- sys/include/net/gnrc/netdev2/ieee802154.h | 46 --- .../net/{netdev2_test.h => netdev_test.h} | 130 ++++---- sys/include/net/netopt.h | 2 +- .../gnrc/application_layer/uhcpc/gnrc_uhcpc.c | 2 +- .../net/gnrc/link_layer/netdev}/Makefile | 2 +- .../gnrc_netdev2.c => netdev/gnrc_netdev.c} | 84 ++--- .../gnrc_netdev_eth.c} | 40 +-- .../gnrc_netdev_ieee802154.c} | 40 +-- .../gnrc_netdev_xbee.c} | 20 +- sys/net/link_layer/csma_sender/csma_sender.c | 10 +- .../{netdev2_test => netdev_test}/Makefile | 0 .../netdev_test.c} | 48 +-- tests/driver_at86rf2xx/cmd.c | 40 +-- tests/driver_at86rf2xx/common.h | 4 +- tests/driver_at86rf2xx/main.c | 16 +- tests/driver_at86rf2xx/recv.c | 6 +- tests/driver_enc28j60/Makefile | 2 +- tests/driver_encx24j600/Makefile | 2 +- tests/driver_xbee/Makefile | 2 +- tests/emb6/main.c | 8 +- tests/lwip/Makefile | 4 +- tests/lwip_sock_ip/Makefile | 6 +- tests/lwip_sock_ip/README.md | 2 +- tests/lwip_sock_ip/stack.c | 68 ++-- tests/lwip_sock_tcp/Makefile | 6 +- tests/lwip_sock_tcp/README.md | 2 +- tests/lwip_sock_udp/Makefile | 6 +- tests/lwip_sock_udp/README.md | 2 +- tests/lwip_sock_udp/stack.c | 68 ++-- tests/{netdev2_test => netdev_test}/Makefile | 6 +- tests/{netdev2_test => netdev_test}/main.c | 54 +-- 136 files changed, 1554 insertions(+), 1748 deletions(-) rename cpu/native/include/{netdev2_tap.h => netdev_tap.h} (69%) rename cpu/native/include/{netdev2_tap_params.h => netdev_tap_params.h} (57%) rename cpu/native/{netdev2_tap => netdev_tap}/Makefile (100%) rename cpu/native/{netdev2_tap/netdev2_tap.c => netdev_tap/netdev_tap.c} (78%) rename drivers/cc110x/{cc110x-netdev2.c => cc110x-netdev.c} (67%) rename drivers/cc110x/gnrc_cc110x/{gnrc_netdev2_cc110x.c => gnrc_netdev_cc110x.c} (81%) rename drivers/cc110x/include/{cc110x-netdev2.h => cc110x-netdev.h} (61%) rename drivers/cc110x/include/{gnrc_netdev2_cc110x.h => gnrc_netdev_cc110x.h} (77%) rename drivers/include/net/{netdev2.h => netdev.h} (69%) rename drivers/include/net/{netdev2 => netdev}/eth.h (66%) rename drivers/include/net/{netdev2 => netdev}/ieee802154.h (58%) rename drivers/{netdev2_eth => netdev_eth}/Makefile (100%) rename drivers/{netdev2_eth/netdev2_eth.c => netdev_eth/netdev_eth.c} (84%) rename drivers/{netdev2_ieee802154 => netdev_ieee802154}/Makefile (100%) rename drivers/{netdev2_ieee802154/netdev2_ieee802154.c => netdev_ieee802154/netdev_ieee802154.c} (85%) rename pkg/emb6/contrib/{netdev2 => netdev}/Makefile (61%) rename pkg/emb6/contrib/{netdev2/emb6_netdev2.c => netdev/emb6_netdev.c} (61%) rename pkg/emb6/include/emb6/{netdev2.h => netdev.h} (77%) rename {sys/net/gnrc/link_layer/netdev2 => pkg/lwip/contrib/netdev}/Makefile (61%) rename pkg/lwip/contrib/{netdev2/lwip_netdev2.c => netdev/lwip_netdev.c} (78%) rename pkg/lwip/include/lwip/netif/{netdev2.h => netdev.h} (65%) delete mode 100644 sys/auto_init/netif/auto_init_netdev2_tap.c create mode 100644 sys/auto_init/netif/auto_init_netdev_tap.c rename sys/include/net/gnrc/{netdev2 => netdev}/eth.h (50%) create mode 100644 sys/include/net/gnrc/netdev/ieee802154.h rename sys/include/net/gnrc/{netdev2 => netdev}/xbee_adpt.h (70%) delete mode 100644 sys/include/net/gnrc/netdev2.h delete mode 100644 sys/include/net/gnrc/netdev2/ieee802154.h rename sys/include/net/{netdev2_test.h => netdev_test.h} (61%) rename {pkg/lwip/contrib/netdev2 => sys/net/gnrc/link_layer/netdev}/Makefile (60%) rename sys/net/gnrc/link_layer/{netdev2/gnrc_netdev2.c => netdev/gnrc_netdev.c} (60%) rename sys/net/gnrc/link_layer/{netdev2/gnrc_netdev2_eth.c => netdev/gnrc_netdev_eth.c} (83%) rename sys/net/gnrc/link_layer/{netdev2/gnrc_netdev2_ieee802154.c => netdev/gnrc_netdev_ieee802154.c} (84%) rename sys/net/gnrc/link_layer/{netdev2/gnrc_netdev2_xbee.c => netdev/gnrc_netdev_xbee.c} (91%) rename sys/net/{netdev2_test => netdev_test}/Makefile (100%) rename sys/net/{netdev2_test/netdev2_test.c => netdev_test/netdev_test.c} (64%) rename tests/{netdev2_test => netdev_test}/Makefile (80%) rename tests/{netdev2_test => netdev_test}/main.c (87%) diff --git a/Makefile.dep b/Makefile.dep index 95a1c4542a..9037185244 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -26,11 +26,11 @@ endif ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) USEMODULE += gnrc_netif - USEMODULE += gnrc_netdev2 + USEMODULE += gnrc_netdev USEMODULE += netdev_default endif -ifneq (,$(filter netdev2_ieee802154,$(USEMODULE))) +ifneq (,$(filter netdev_ieee802154,$(USEMODULE))) USEMODULE += ieee802154 endif @@ -47,7 +47,7 @@ ifneq (,$(filter nordic_softdevice_ble,$(USEPKG))) USEMODULE += gnrc_sixlowpan USEMODULE += gnrc_sixlowpan_iphc USEMODULE += gnrc_ipv6_default - USEMODULE += gnrc_netdev2 + USEMODULE += gnrc_netdev USEMODULE += gnrc_ipv6_netif endif @@ -86,11 +86,11 @@ ifneq (,$(filter gnrc_netapi_mbox,$(USEMODULE))) USEMODULE += core_mbox endif -ifneq (,$(filter netdev2_tap,$(USEMODULE))) +ifneq (,$(filter netdev_tap,$(USEMODULE))) USEMODULE += netif - USEMODULE += netdev2_eth + USEMODULE += netdev_eth ifneq (,$(filter gnrc_%,$(USEMODULE))) - USEMODULE += gnrc_netdev2 + USEMODULE += gnrc_netdev endif endif @@ -534,7 +534,7 @@ ifneq (,$(filter gnrc_pktbuf_%, $(USEMODULE))) USEMODULE += gnrc_pktbuf # make MODULE_GNRC_PKTBUF macro available for all implementations endif -ifneq (,$(filter gnrc_netdev2,$(USEMODULE))) +ifneq (,$(filter gnrc_netdev,$(USEMODULE))) USEMODULE += netopt endif diff --git a/README.md b/README.md index 973b5c136c..e1f4e964b5 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ but not limited to: `WERROR=0 make` ### USING THE NATIVE PORT WITH NETWORKING -If you compile RIOT for the native cpu and include the `netdev2_tap` module, +If you compile RIOT for the native cpu and include the `netdev_tap` module, you can specify a network interface like this: `PORT=tap0 make term` #### SETTING UP A TAP NETWORK diff --git a/boards/cc2538dk/Makefile.dep b/boards/cc2538dk/Makefile.dep index 3030d87f8b..b52d3f1304 100644 --- a/boards/cc2538dk/Makefile.dep +++ b/boards/cc2538dk/Makefile.dep @@ -1,6 +1,6 @@ ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) USEMODULE += netif USEMODULE += cc2538_rf - USEMODULE += gnrc_netdev2 - USEMODULE += netdev2_ieee802154 + USEMODULE += gnrc_netdev + USEMODULE += netdev_ieee802154 endif diff --git a/boards/native/Makefile.dep b/boards/native/Makefile.dep index 0806ebe2a7..5af0b5ddfa 100644 --- a/boards/native/Makefile.dep +++ b/boards/native/Makefile.dep @@ -1,3 +1,3 @@ ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE))) - USEMODULE += netdev2_tap + USEMODULE += netdev_tap endif diff --git a/boards/openmote-cc2538/Makefile.dep b/boards/openmote-cc2538/Makefile.dep index 3030d87f8b..b52d3f1304 100644 --- a/boards/openmote-cc2538/Makefile.dep +++ b/boards/openmote-cc2538/Makefile.dep @@ -1,6 +1,6 @@ ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) USEMODULE += netif USEMODULE += cc2538_rf - USEMODULE += gnrc_netdev2 - USEMODULE += netdev2_ieee802154 + USEMODULE += gnrc_netdev + USEMODULE += netdev_ieee802154 endif diff --git a/boards/remote-common/Makefile.dep b/boards/remote-common/Makefile.dep index 1c0c955490..c469001389 100644 --- a/boards/remote-common/Makefile.dep +++ b/boards/remote-common/Makefile.dep @@ -1,8 +1,8 @@ ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) USEMODULE += netif USEMODULE += cc2538_rf - USEMODULE += gnrc_netdev2 - USEMODULE += netdev2_ieee802154 + USEMODULE += gnrc_netdev + USEMODULE += netdev_ieee802154 endif ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio diff --git a/cpu/cc2538/include/cc2538_rf.h b/cpu/cc2538/include/cc2538_rf.h index 6a96d7a868..f623fdc556 100644 --- a/cpu/cc2538/include/cc2538_rf.h +++ b/cpu/cc2538/include/cc2538_rf.h @@ -25,8 +25,8 @@ #include #include "net/ieee802154.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #ifdef __cplusplus extern "C" { @@ -167,10 +167,10 @@ enum { /** * @brief Device descriptor for CC2538 transceiver * - * @extends netdev2_ieee802154_t + * @extends netdev_ieee802154_t */ typedef struct { - netdev2_ieee802154_t netdev; /**< netdev2 parent struct */ + netdev_ieee802154_t netdev; /**< netdev parent struct */ uint8_t state; /**< current state of the radio */ } cc2538_rf_t; diff --git a/cpu/cc2538/include/cc2538_rf_netdev.h b/cpu/cc2538/include/cc2538_rf_netdev.h index fc0fc05554..e3f52648e4 100644 --- a/cpu/cc2538/include/cc2538_rf_netdev.h +++ b/cpu/cc2538/include/cc2538_rf_netdev.h @@ -20,7 +20,7 @@ #ifndef CC2538_RF_NETDEV_H #define CC2538_RF_NETDEV_H -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -29,7 +29,7 @@ extern "C" { /** * @brief Reference to the netdev device driver struct */ -extern const netdev2_driver_t cc2538_rf_driver; +extern const netdev_driver_t cc2538_rf_driver; #ifdef __cplusplus } diff --git a/cpu/cc2538/radio/cc2538_rf.c b/cpu/cc2538/radio/cc2538_rf.c index 6e2c2fb195..43fd9b2b6c 100644 --- a/cpu/cc2538/radio/cc2538_rf.c +++ b/cpu/cc2538/radio/cc2538_rf.c @@ -173,7 +173,7 @@ bool cc2538_on(void) void cc2538_setup(cc2538_rf_t *dev) { - netdev2_t *netdev = (netdev2_t *)dev; + netdev_t *netdev = (netdev_t *)dev; netdev->driver = &cc2538_rf_driver; diff --git a/cpu/cc2538/radio/cc2538_rf_netdev.c b/cpu/cc2538/radio/cc2538_rf_netdev.c index 449f064a63..d8da350b1e 100644 --- a/cpu/cc2538/radio/cc2538_rf_netdev.c +++ b/cpu/cc2538/radio/cc2538_rf_netdev.c @@ -22,7 +22,7 @@ #include #include "net/gnrc.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "cc2538_rf.h" #include "cc2538_rf_netdev.h" @@ -33,14 +33,14 @@ #define _MAX_MHR_OVERHEAD (25) -static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len); -static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len); -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count); -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info); -static void _isr(netdev2_t *netdev); -static int _init(netdev2_t *dev); +static int _get(netdev_t *dev, netopt_t opt, void *value, size_t max_len); +static int _set(netdev_t *dev, netopt_t opt, void *value, size_t value_len); +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count); +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); +static void _isr(netdev_t *netdev); +static int _init(netdev_t *dev); -const netdev2_driver_t cc2538_rf_driver = { +const netdev_driver_t cc2538_rf_driver = { .get = _get, .set = _set, .send = _send, @@ -50,16 +50,16 @@ const netdev2_driver_t cc2538_rf_driver = { }; /* Reference pointer for the IRQ handler */ -static netdev2_t *_dev; +static netdev_t *_dev; void _irq_handler(void) { if (_dev->event_callback) { - _dev->event_callback(_dev, NETDEV2_EVENT_ISR); + _dev->event_callback(_dev, NETDEV_EVENT_ISR); } } -static int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) +static int _get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len) { cc2538_rf_t *dev = (cc2538_rf_t *)netdev; @@ -89,7 +89,7 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) if (max_len < sizeof(uint16_t)) { return -EOVERFLOW; } - *((uint16_t *) value) = NETDEV2_TYPE_IEEE802154; + *((uint16_t *) value) = NETDEV_TYPE_IEEE802154; return sizeof(uint16_t); case NETOPT_IS_CHANNEL_CLR: @@ -140,15 +140,15 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) int res; - if (((res = netdev2_ieee802154_get((netdev2_ieee802154_t *)netdev, opt, value, - max_len)) >= 0) || (res != -ENOTSUP)) { + if (((res = netdev_ieee802154_get((netdev_ieee802154_t *)netdev, opt, value, + max_len)) >= 0) || (res != -ENOTSUP)) { return res; } return -ENOTSUP; } -static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t value_len) +static int _set(netdev_t *netdev, netopt_t opt, void *value, size_t value_len) { cc2538_rf_t *dev = (cc2538_rf_t *)netdev; int res = -ENOTSUP; @@ -246,14 +246,14 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t value_len) } if (res == -ENOTSUP) { - res = netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, opt, - value, value_len); + res = netdev_ieee802154_set((netdev_ieee802154_t *)netdev, opt, + value, value_len); } return res; } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { int pkt_len = 0; @@ -293,7 +293,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) return pkt_len; } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { size_t pkt_len; @@ -335,7 +335,7 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) if (info != NULL && RFCORE->XREG_RSSISTATbits.RSSI_VALID) { uint8_t corr_val; int8_t rssi_val; - netdev2_ieee802154_rx_info_t *radio_info = info; + netdev_ieee802154_rx_info_t *radio_info = info; rssi_val = rfcore_read_byte() + CC2538_RSSI_OFFSET; RFCORE_ASSERT(rssi_val > CC2538_RF_SENSITIVITY); @@ -364,12 +364,12 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) return pkt_len; } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } -static int _init(netdev2_t *netdev) +static int _init(netdev_t *netdev) { cc2538_rf_t *dev = (cc2538_rf_t *) netdev; _dev = netdev; @@ -379,15 +379,15 @@ static int _init(netdev2_t *netdev) uint16_t addr_short = cc2538_get_addr_short(); uint64_t addr_long = cc2538_get_addr_long(); - /* Initialise netdev2_ieee802154_t struct */ - netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, NETOPT_NID, - &pan, sizeof(pan)); - netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, NETOPT_CHANNEL, - &chan, sizeof(chan)); - netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, NETOPT_ADDRESS, - &addr_short, sizeof(addr_short)); - netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, NETOPT_ADDRESS_LONG, - &addr_long, sizeof(addr_long)); + /* Initialise netdev_ieee802154_t struct */ + netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_NID, &pan, + sizeof(pan)); + netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_CHANNEL, &chan, + sizeof(chan)); + netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_ADDRESS, + &addr_short, sizeof(addr_short)); + netdev_ieee802154_set((netdev_ieee802154_t *)netdev, NETOPT_ADDRESS_LONG, + &addr_long, sizeof(addr_long)); cc2538_set_state(dev, NETOPT_STATE_IDLE); diff --git a/cpu/native/Makefile b/cpu/native/Makefile index d66f5a971e..e2ad9616b1 100644 --- a/cpu/native/Makefile +++ b/cpu/native/Makefile @@ -3,8 +3,8 @@ MODULE = cpu DIRS += periph DIRS += vfs -ifneq (,$(filter netdev2_tap,$(USEMODULE))) - DIRS += netdev2_tap +ifneq (,$(filter netdev_tap,$(USEMODULE))) + DIRS += netdev_tap endif include $(RIOTBASE)/Makefile.base diff --git a/cpu/native/README.md b/cpu/native/README.md index d3d63f55bf..1648ae761e 100644 --- a/cpu/native/README.md +++ b/cpu/native/README.md @@ -34,7 +34,7 @@ server (vgdb). Network Support =============== -If you compile RIOT for the native cpu and include the `netdev2_tap` +If you compile RIOT for the native cpu and include the `netdev_tap` module, you need to specify a network interface like this: make term PORT=tap0 diff --git a/cpu/native/include/netdev2_tap.h b/cpu/native/include/netdev_tap.h similarity index 69% rename from cpu/native/include/netdev2_tap.h rename to cpu/native/include/netdev_tap.h index 3121014981..bba108814a 100644 --- a/cpu/native/include/netdev2_tap.h +++ b/cpu/native/include/netdev_tap.h @@ -7,25 +7,25 @@ */ /** - * @ingroup netdev2 + * @ingroup netdev * @brief Low-level ethernet driver for native tap interfaces * @{ * * @file - * @brief Definitions for @ref netdev2 ethernet driver for host system's + * @brief Definitions for @ref netdev ethernet driver for host system's * TAP interfaces * * @author Kaspar Schleiser */ -#ifndef NETDEV2_TAP_H -#define NETDEV2_TAP_H +#ifndef NETDEV_TAP_H +#define NETDEV_TAP_H #ifdef __cplusplus extern "C" { #endif #include -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/ethernet/hdr.h" @@ -38,13 +38,13 @@ extern "C" { /** * @brief tap interface state */ -typedef struct netdev2_tap { - netdev2_t netdev; /**< netdev2 internal member */ +typedef struct netdev_tap { + netdev_t netdev; /**< netdev internal member */ char tap_name[IFNAMSIZ]; /**< host dev file name */ int tap_fd; /**< host file descriptor for the TAP */ uint8_t addr[ETHERNET_ADDR_LEN]; /**< The MAC address of the TAP */ uint8_t promiscous; /**< Flag for promiscous mode */ -} netdev2_tap_t; +} netdev_tap_t; /** * @brief tap interface initialization parameters @@ -52,18 +52,18 @@ typedef struct netdev2_tap { typedef struct { char **tap_name; /**< Name of the host system's tap inteface to bind to. */ -} netdev2_tap_params_t; +} netdev_tap_params_t; /** - * @brief Setup netdev2_tap_t structure. + * @brief Setup netdev_tap_t structure. * - * @param dev the preallocated netdev2_tap device handle to setup + * @param dev the preallocated netdev_tap device handle to setup * @param params initialization parameters */ -void netdev2_tap_setup(netdev2_tap_t *dev, const netdev2_tap_params_t *params); +void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params); #ifdef __cplusplus } #endif /** @} */ -#endif /* NETDEV2_TAP_H */ +#endif /* NETDEV_TAP_H */ diff --git a/cpu/native/include/netdev2_tap_params.h b/cpu/native/include/netdev_tap_params.h similarity index 57% rename from cpu/native/include/netdev2_tap_params.h rename to cpu/native/include/netdev_tap_params.h index bde2ec52d9..17038dd106 100644 --- a/cpu/native/include/netdev2_tap_params.h +++ b/cpu/native/include/netdev_tap_params.h @@ -7,44 +7,44 @@ */ /** - * @ingroup netdev2 + * @ingroup netdev * @brief * @{ * * @file - * @brief Default configuration for the netdev2_tap driver + * @brief Default configuration for the netdev_tap driver * * @author Martine Lenders */ -#ifndef NETDEV2_TAP_PARAMS_H_ -#define NETDEV2_TAP_PARAMS_H_ +#ifndef NETDEV_TAP_PARAMS_H_ +#define NETDEV_TAP_PARAMS_H_ -#include "netdev2_tap.h" +#include "netdev_tap.h" #ifdef __cplusplus extern "C" { #endif /** - * @brief Number of allocated parameters at @ref netdev2_tap_params + * @brief Number of allocated parameters at @ref netdev_tap_params * * @note This was decided to only be configurable on compile-time to be * more similar to actual boards */ -#ifndef NETDEV2_TAP_MAX -#define NETDEV2_TAP_MAX (1) +#ifndef NETDEV_TAP_MAX +#define NETDEV_TAP_MAX (1) #endif /** - * @brief Configuration parameters for @ref netdev2_tap_t + * @brief Configuration parameters for @ref netdev_tap_t * * @note This variable is set on native start-up based on arguments provided */ -extern netdev2_tap_params_t netdev2_tap_params[NETDEV2_TAP_MAX]; +extern netdev_tap_params_t netdev_tap_params[NETDEV_TAP_MAX]; #ifdef __cplusplus } #endif -#endif /* NETDEV2_TAP_PARAMS_H_ */ +#endif /* NETDEV_TAP_PARAMS_H_ */ /** @} */ diff --git a/cpu/native/native_cpu.c b/cpu/native/native_cpu.c index 73f5608266..9d07a72dc6 100644 --- a/cpu/native/native_cpu.c +++ b/cpu/native/native_cpu.c @@ -52,9 +52,9 @@ #include "cpu.h" #include "cpu_conf.h" -#ifdef MODULE_NETDEV2_TAP -#include "netdev2_tap.h" -extern netdev2_tap_t netdev2_tap; +#ifdef MODULE_NETDEV_TAP +#include "netdev_tap.h" +extern netdev_tap_t netdev_tap; #endif #include "native_internal.h" diff --git a/cpu/native/netdev2_tap/Makefile b/cpu/native/netdev_tap/Makefile similarity index 100% rename from cpu/native/netdev2_tap/Makefile rename to cpu/native/netdev_tap/Makefile diff --git a/cpu/native/netdev2_tap/netdev2_tap.c b/cpu/native/netdev_tap/netdev_tap.c similarity index 78% rename from cpu/native/netdev2_tap/netdev2_tap.c rename to cpu/native/netdev_tap/netdev_tap.c index d936e778e0..0a00375193 100644 --- a/cpu/native/netdev2_tap/netdev2_tap.c +++ b/cpu/native/netdev_tap/netdev_tap.c @@ -10,7 +10,7 @@ */ /* - * @ingroup netdev2 + * @ingroup netdev * @{ * @brief Low-level ethernet driver for tap interfaces * @author Kaspar Schleiser @@ -49,60 +49,60 @@ #include "async_read.h" #include "net/eui64.h" -#include "net/netdev2.h" -#include "net/netdev2/eth.h" +#include "net/netdev.h" +#include "net/netdev/eth.h" #include "net/ethernet.h" #include "net/ethernet/hdr.h" -#include "netdev2_tap.h" +#include "netdev_tap.h" #include "net/netopt.h" #include "net/eui64.h" #define ENABLE_DEBUG (0) #include "debug.h" -/* netdev2 interface */ -static int _init(netdev2_t *netdev); -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n); -static int _recv(netdev2_t *netdev, void *buf, size_t n, void *info); +/* netdev interface */ +static int _init(netdev_t *netdev); +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned n); +static int _recv(netdev_t *netdev, void *buf, size_t n, void *info); -static inline void _get_mac_addr(netdev2_t *netdev, uint8_t *dst) +static inline void _get_mac_addr(netdev_t *netdev, uint8_t *dst) { - netdev2_tap_t *dev = (netdev2_tap_t*)netdev; + netdev_tap_t *dev = (netdev_tap_t*)netdev; memcpy(dst, dev->addr, ETHERNET_ADDR_LEN); } -static inline void _set_mac_addr(netdev2_t *netdev, uint8_t *src) +static inline void _set_mac_addr(netdev_t *netdev, uint8_t *src) { - netdev2_tap_t *dev = (netdev2_tap_t*)netdev; + netdev_tap_t *dev = (netdev_tap_t*)netdev; memcpy(dev->addr, src, ETHERNET_ADDR_LEN); } -static inline int _get_promiscous(netdev2_t *netdev) +static inline int _get_promiscous(netdev_t *netdev) { - netdev2_tap_t *dev = (netdev2_tap_t*)netdev; + netdev_tap_t *dev = (netdev_tap_t*)netdev; return dev->promiscous; } -static inline int _set_promiscous(netdev2_t *netdev, int value) +static inline int _set_promiscous(netdev_t *netdev, int value) { - netdev2_tap_t *dev = (netdev2_tap_t*)netdev; + netdev_tap_t *dev = (netdev_tap_t*)netdev; dev->promiscous = value; return value; } -static inline void _isr(netdev2_t *netdev) +static inline void _isr(netdev_t *netdev) { if (netdev->event_callback) { - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } #if DEVELHELP else { - puts("netdev2_tap: _isr(): no event_callback set."); + puts("netdev_tap: _isr(): no event_callback set."); } #endif } -static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) +static int _get(netdev_t *dev, netopt_t opt, void *value, size_t max_len) { int res = 0; @@ -121,14 +121,14 @@ static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) res = sizeof(bool); break; default: - res = netdev2_eth_get(dev, opt, value, max_len); + res = netdev_eth_get(dev, opt, value, max_len); break; } return res; } -static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len) +static int _set(netdev_t *dev, netopt_t opt, void *value, size_t value_len) { (void)value_len; int res = 0; @@ -148,7 +148,7 @@ static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len) return res; } -static netdev2_driver_t netdev2_driver_tap = { +static netdev_driver_t netdev_driver_tap = { .send = _send, .recv = _recv, .init = _init, @@ -170,7 +170,7 @@ static inline bool _is_addr_multicast(uint8_t *addr) return (addr[0] & 0x01); } -static void _continue_reading(netdev2_tap_t *dev) +static void _continue_reading(netdev_tap_t *dev) { /* work around lost signals */ fd_set rfds; @@ -187,25 +187,25 @@ static void _continue_reading(netdev2_tap_t *dev) extern ssize_t (*real_write)(int fd, const void * buf, size_t count); real_write(_sig_pipefd[1], &sig, sizeof(int)); _native_sigpend++; - DEBUG("netdev2_tap: sigpend++\n"); + DEBUG("netdev_tap: sigpend++\n"); } else { - DEBUG("netdev2_tap: native_async_read_continue\n"); + DEBUG("netdev_tap: native_async_read_continue\n"); native_async_read_continue(dev->tap_fd); } _native_in_syscall--; } -static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { - netdev2_tap_t *dev = (netdev2_tap_t*)netdev2; + netdev_tap_t *dev = (netdev_tap_t*)netdev; (void)info; if (!buf) { if (len > 0) { /* no memory available in pktbuf, discarding the frame */ - DEBUG("netdev2_tap: discarding the frame\n"); + DEBUG("netdev_tap: discarding the frame\n"); /* repeating `real_read` for small size on tap device results in * freeze for some reason. Using a large buffer for now. */ @@ -228,14 +228,14 @@ static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info) } int nread = real_read(dev->tap_fd, buf, len); - DEBUG("netdev2_tap: read %d bytes\n", nread); + DEBUG("netdev_tap: 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("netdev2_tap: received for %02x:%02x:%02x:%02x:%02x:%02x\n" + DEBUG("netdev_tap: 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]); @@ -248,8 +248,8 @@ static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info) _continue_reading(dev); #ifdef MODULE_NETSTATS_L2 - netdev2->stats.rx_count++; - netdev2->stats.rx_bytes += nread; + netdev->stats.rx_count++; + netdev->stats.rx_bytes += nread; #endif return nread; } @@ -257,7 +257,7 @@ static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info) if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { } else { - err(EXIT_FAILURE, "netdev2_tap: read"); + err(EXIT_FAILURE, "netdev_tap: read"); } } else if (nread == 0) { @@ -270,9 +270,9 @@ static int _recv(netdev2_t *netdev2, void *buf, size_t len, void *info) return -1; } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned n) { - netdev2_tap_t *dev = (netdev2_tap_t*)netdev; + netdev_tap_t *dev = (netdev_tap_t*)netdev; int res = _native_writev(dev->tap_fd, vector, n); #ifdef MODULE_NETSTATS_L2 size_t bytes = 0; @@ -283,34 +283,34 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n) netdev->stats.tx_bytes += bytes; #endif if (netdev->event_callback) { - netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); } return res; } -void netdev2_tap_setup(netdev2_tap_t *dev, const netdev2_tap_params_t *params) { - dev->netdev.driver = &netdev2_driver_tap; +void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params) { + dev->netdev.driver = &netdev_driver_tap; strncpy(dev->tap_name, *(params->tap_name), IFNAMSIZ); } static void _tap_isr(int fd, void *arg) { (void) fd; - netdev2_t *netdev = (netdev2_t *)arg; + netdev_t *netdev = (netdev_t *)arg; if (netdev->event_callback) { - netdev->event_callback(netdev, NETDEV2_EVENT_ISR); + netdev->event_callback(netdev, NETDEV_EVENT_ISR); } else { - puts("netdev2_tap: _isr: no event callback."); + puts("netdev_tap: _isr: no event callback."); } } -static int _init(netdev2_t *netdev) +static int _init(netdev_t *netdev) { DEBUG("%s:%s:%u\n", RIOT_FILE_RELATIVE, __func__, __LINE__); - netdev2_tap_t *dev = (netdev2_tap_t*)netdev; + netdev_tap_t *dev = (netdev_tap_t*)netdev; /* check device parametrs */ if (dev == NULL) { diff --git a/cpu/native/startup.c b/cpu/native/startup.c index 281f2db4ae..3582b69cb9 100644 --- a/cpu/native/startup.c +++ b/cpu/native/startup.c @@ -59,10 +59,10 @@ unsigned _native_rng_seed = 0; int _native_rng_mode = 0; const char *_native_unix_socket_path = NULL; -#ifdef MODULE_NETDEV2_TAP -#include "netdev2_tap_params.h" +#ifdef MODULE_NETDEV_TAP +#include "netdev_tap_params.h" -netdev2_tap_params_t netdev2_tap_params[NETDEV2_TAP_MAX]; +netdev_tap_params_t netdev_tap_params[NETDEV_TAP_MAX]; #endif static const char short_opts[] = ":hi:s:deEoc:"; @@ -199,8 +199,8 @@ void usage_exit(int status) { real_printf("usage: %s", _progname); -#if defined(MODULE_NETDEV2_TAP) - for (int i = 0; i < NETDEV2_TAP_MAX; i++) { +#if defined(MODULE_NETDEV_TAP) + for (int i = 0; i < NETDEV_TAP_MAX; i++) { real_printf(" ", i + 1); } #endif @@ -289,8 +289,8 @@ __attribute__((constructor)) static void startup(int argc, char **argv) usage_exit(EXIT_FAILURE); } } -#ifdef MODULE_NETDEV2_TAP - for (int i = 0; i < NETDEV2_TAP_MAX; i++) { +#ifdef MODULE_NETDEV_TAP + for (int i = 0; i < NETDEV_TAP_MAX; i++) { if (argv[optind + i] == NULL) { /* no tap parameter left */ usage_exit(EXIT_FAILURE); @@ -321,9 +321,9 @@ __attribute__((constructor)) static void startup(int argc, char **argv) native_cpu_init(); native_interrupt_init(); -#ifdef MODULE_NETDEV2_TAP - for (int i = 0; i < NETDEV2_TAP_MAX; i++) { - netdev2_tap_params[i].tap_name = &argv[optind + i]; +#ifdef MODULE_NETDEV_TAP + for (int i = 0; i < NETDEV_TAP_MAX; i++) { + netdev_tap_params[i].tap_name = &argv[optind + i]; } #endif diff --git a/cpu/nrf5x_common/include/nrfmin.h b/cpu/nrf5x_common/include/nrfmin.h index ccba682418..7aa02e3085 100644 --- a/cpu/nrf5x_common/include/nrfmin.h +++ b/cpu/nrf5x_common/include/nrfmin.h @@ -72,7 +72,7 @@ #ifndef NRFMIN_H #define NRFMIN_H -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -134,14 +134,14 @@ typedef union { } nrfmin_pkt_t; /** - * @brief Export the netdev2 device descriptor + * @brief Export the netdev device descriptor */ -extern netdev2_t nrfmin_dev; +extern netdev_t nrfmin_dev; /** * @brief Reference to the netdev driver interface */ -extern const netdev2_driver_t nrfmin_netdev; +extern const netdev_driver_t nrfmin_netdev; /** * @brief Setup the device driver's data structures diff --git a/cpu/nrf5x_common/include/nrfmin_gnrc.h b/cpu/nrf5x_common/include/nrfmin_gnrc.h index 4b62af6e2f..432dff0189 100644 --- a/cpu/nrf5x_common/include/nrfmin_gnrc.h +++ b/cpu/nrf5x_common/include/nrfmin_gnrc.h @@ -38,7 +38,7 @@ extern "C" { * function can be called from auto_init as is, without the need for external * memory allocation. */ -void gnrc_netdev2_nrfmin_init(void); +void gnrc_netdev_nrfmin_init(void); #ifdef __cplusplus } diff --git a/cpu/nrf5x_common/radio/nrfmin/nrfmin.c b/cpu/nrf5x_common/radio/nrfmin/nrfmin.c index c6cc5a390c..6c8f78c5ff 100644 --- a/cpu/nrf5x_common/radio/nrfmin/nrfmin.c +++ b/cpu/nrf5x_common/radio/nrfmin/nrfmin.c @@ -29,7 +29,7 @@ #include "periph/cpuid.h" #include "nrfmin.h" -#include "net/netdev2.h" +#include "net/netdev.h" #define ENABLE_DEBUG (0) #include "debug.h" @@ -90,7 +90,7 @@ typedef enum { /** * @brief Since there can only be 1 nrfmin device, we allocate it right here */ -netdev2_t nrfmin_dev; +netdev_t nrfmin_dev; /** * @brief For faster lookup we remember our own 16-bit address @@ -311,7 +311,7 @@ void isr_radio(void) return; } rx_lock = 0; - nrfmin_dev.event_callback(&nrfmin_dev, NETDEV2_EVENT_ISR); + nrfmin_dev.event_callback(&nrfmin_dev, NETDEV_EVENT_ISR); } else if (state == STATE_TX) { goto_target_state(); @@ -321,7 +321,7 @@ void isr_radio(void) cortexm_isr_end(); } -static int nrfmin_send(netdev2_t *dev, const struct iovec *vector, unsigned count) +static int nrfmin_send(netdev_t *dev, const struct iovec *vector, unsigned count) { (void)dev; @@ -355,7 +355,7 @@ static int nrfmin_send(netdev2_t *dev, const struct iovec *vector, unsigned coun return (int)count; } -static int nrfmin_recv(netdev2_t *dev, void *buf, size_t len, void *info) +static int nrfmin_recv(netdev_t *dev, void *buf, size_t len, void *info) { (void)dev; (void)info; @@ -390,7 +390,7 @@ static int nrfmin_recv(netdev2_t *dev, void *buf, size_t len, void *info) return pktlen; } -static int nrfmin_init(netdev2_t *dev) +static int nrfmin_init(netdev_t *dev) { uint8_t cpuid[CPUID_LEN]; @@ -449,14 +449,14 @@ static int nrfmin_init(netdev2_t *dev) return 0; } -static void nrfmin_isr(netdev2_t *dev) +static void nrfmin_isr(netdev_t *dev) { if (nrfmin_dev.event_callback) { - nrfmin_dev.event_callback(dev, NETDEV2_EVENT_RX_COMPLETE); + nrfmin_dev.event_callback(dev, NETDEV_EVENT_RX_COMPLETE); } } -static int nrfmin_get(netdev2_t *dev, netopt_t opt, void *val, size_t max_len) +static int nrfmin_get(netdev_t *dev, netopt_t opt, void *val, size_t max_len) { (void)dev; @@ -494,7 +494,7 @@ static int nrfmin_get(netdev2_t *dev, netopt_t opt, void *val, size_t max_len) return 2; case NETOPT_DEVICE_TYPE: assert(max_len >= sizeof(uint16_t)); - *((uint16_t *)val) = NETDEV2_TYPE_NRFMIN; + *((uint16_t *)val) = NETDEV_TYPE_NRFMIN; return sizeof(uint16_t); case NETOPT_IPV6_IID: assert(max_len >= sizeof(uint64_t)); @@ -505,7 +505,7 @@ static int nrfmin_get(netdev2_t *dev, netopt_t opt, void *val, size_t max_len) } } -static int nrfmin_set(netdev2_t *dev, netopt_t opt, void *val, size_t len) +static int nrfmin_set(netdev_t *dev, netopt_t opt, void *val, size_t len) { (void)dev; @@ -537,9 +537,9 @@ static int nrfmin_set(netdev2_t *dev, netopt_t opt, void *val, size_t len) } /** - * @brief Export of the netdev2 interface + * @brief Export of the netdev interface */ -const netdev2_driver_t nrfmin_netdev = { +const netdev_driver_t nrfmin_netdev = { .send = nrfmin_send, .recv = nrfmin_recv, .init = nrfmin_init, diff --git a/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c b/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c index 9253d490f4..d43c7d0d9e 100644 --- a/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c +++ b/cpu/nrf5x_common/radio/nrfmin/nrfmin_gnrc.c @@ -19,7 +19,7 @@ */ #include "thread.h" -#include "net/gnrc/netdev2.h" +#include "net/gnrc/netdev.h" #include "nrfmin_gnrc.h" @@ -31,7 +31,7 @@ * @{ */ #ifndef NRFMIN_GNRC_THREAD_PRIO -#define NRFMIN_GNRC_THREAD_PRIO GNRC_NETDEV2_MAC_PRIO +#define NRFMIN_GNRC_THREAD_PRIO GNRC_NETDEV_MAC_PRIO #endif #ifndef NRFMIN_GNRC_STACKSIZE @@ -45,14 +45,14 @@ #define BCAST (GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST) /** - * @brief Allocate the stack for the GNRC netdev2 thread to run in + * @brief Allocate the stack for the GNRC netdev thread to run in */ static char stack[NRFMIN_GNRC_STACKSIZE]; /** - * @brief Allocate the GNRC netdev2 data structure. + * @brief Allocate the GNRC netdev data structure. */ -static gnrc_netdev2_t plug; +static gnrc_netdev_t plug; static int hdr_netif_to_nrfmin(nrfmin_hdr_t *nrfmin, gnrc_pktsnip_t *pkt) @@ -81,7 +81,7 @@ static int hdr_netif_to_nrfmin(nrfmin_hdr_t *nrfmin, gnrc_pktsnip_t *pkt) return 0; } -static int gnrc_nrfmin_send(gnrc_netdev2_t *dev, gnrc_pktsnip_t *pkt) +static int gnrc_nrfmin_send(gnrc_netdev_t *dev, gnrc_pktsnip_t *pkt) { int res; struct iovec *vec; @@ -124,7 +124,7 @@ static int gnrc_nrfmin_send(gnrc_netdev2_t *dev, gnrc_pktsnip_t *pkt) return res; } -static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netdev2_t *dev) +static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netdev_t *dev) { int pktsize; nrfmin_hdr_t *nrfmin; @@ -195,7 +195,7 @@ void gnrc_nrfmin_init(void) plug.recv = gnrc_nrfmin_recv; plug.dev = &nrfmin_dev; - gnrc_netdev2_init(stack, sizeof(stack), + gnrc_netdev_init(stack, sizeof(stack), NRFMIN_GNRC_THREAD_PRIO, "nrfmin", &plug); } diff --git a/dist/tools/ethos/README.md b/dist/tools/ethos/README.md index 2131251dae..36a2310299 100644 --- a/dist/tools/ethos/README.md +++ b/dist/tools/ethos/README.md @@ -8,7 +8,7 @@ To use, add # GNRC_NETIF_NUMOF := 2 - USEMODULE += ethos gnrc_netdev2 + USEMODULE += ethos gnrc_netdev CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200 -DUSE_ETHOS_FOR_STDIO to app Makefile, "make clean all flash", then run this tool so follows: diff --git a/doc/doxygen/src/getting-started.md b/doc/doxygen/src/getting-started.md index 02de0bd1ec..44839049a8 100644 --- a/doc/doxygen/src/getting-started.md +++ b/doc/doxygen/src/getting-started.md @@ -71,7 +71,7 @@ terminal tools for the specified platform. These targets use the variable the targets `flash` and `term` are mandatory for the native port. For the native port, `PORT` has a special meaning: it is used to identify the -tap interface if the `netdev2_tap` module is used. The target `debug` can be +tap interface if the `netdev_tap` module is used. The target `debug` can be used to invoke a debugger on some platforms. For the native port the additional targets such as `all-valgrind` and `valgrind` exist. Refer to `cpu/native/README.md` for additional information diff --git a/doc/doxygen/src/riot-gnrc.svg b/doc/doxygen/src/riot-gnrc.svg index e6aff396d1..7af27317be 100644 --- a/doc/doxygen/src/riot-gnrc.svg +++ b/doc/doxygen/src/riot-gnrc.svg @@ -426,9 +426,9 @@ stroke-miterlimit: 4; stroke-width: 3; } - #gnrc-detail-netdev2 { + #gnrc-detail-netdev { fill: none; - stroke: url(#outer-gradient-netdev2); + stroke: url(#outer-gradient-netdev); stroke-linecap: round; stroke-linejoin: miter; stroke-miterlimit: 4; @@ -476,7 +476,7 @@ - + @@ -494,7 +494,7 @@ - + @@ -547,9 +547,9 @@ gnrc_ipv6 - - - + + netapi @@ -563,12 +563,12 @@ gnrc_sixlowpan - - - + + netapi - + gnrc_netdev2 + x="282.5" y="352">gnrc_netdev diff --git a/doc/doxygen/src/riot-structure.svg b/doc/doxygen/src/riot-structure.svg index 58f4503022..79630f06aa 100755 --- a/doc/doxygen/src/riot-structure.svg +++ b/doc/doxygen/src/riot-structure.svg @@ -423,9 +423,9 @@ stroke-miterlimit: 4; stroke-width: 3; } - #gnrc-detail-netdev2 { + #gnrc-detail-netdev { fill: none; - stroke: url(#outer-gradient-netdev2); + stroke: url(#outer-gradient-netdev); stroke-linecap: round; stroke-linejoin: miter; stroke-miterlimit: 4; @@ -473,7 +473,7 @@ - + diff --git a/drivers/Makefile.dep b/drivers/Makefile.dep index 67b72ba398..45ab703c84 100644 --- a/drivers/Makefile.dep +++ b/drivers/Makefile.dep @@ -11,11 +11,11 @@ ifneq (,$(filter at86rf2%,$(USEMODULE))) USEMODULE += luid USEMODULE += netif USEMODULE += ieee802154 - USEMODULE += netdev2_ieee802154 + USEMODULE += netdev_ieee802154 ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) # XXX: this can be modelled as a dependency for gnrc_netdev_default as soon - # as all drivers are ported to netdev2 - USEMODULE += gnrc_netdev2 + # as all drivers are ported to netdev + USEMODULE += gnrc_netdev endif endif @@ -24,11 +24,11 @@ ifneq (,$(filter mrf24j40,$(USEMODULE))) USEMODULE += luid USEMODULE += netif USEMODULE += ieee802154 - USEMODULE += netdev2_ieee802154 + USEMODULE += netdev_ieee802154 ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) # XXX: this can be modelled as a dependency for gnrc_netdev_default as soon - # as all drivers are ported to netdev2 - USEMODULE += gnrc_netdev2 + # as all drivers are ported to netdev + USEMODULE += gnrc_netdev endif endif @@ -54,8 +54,8 @@ ifneq (,$(filter cc110x,$(USEMODULE))) ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) USEMODULE += gnrc_cc110x # XXX: this can be modelled as a dependency for gnrc_netdev_default as soon - # as all drivers are ported to netdev2 - USEMODULE += gnrc_netdev2 + # as all drivers are ported to netdev + USEMODULE += gnrc_netdev endif endif @@ -64,11 +64,11 @@ ifneq (,$(filter cc2420,$(USEMODULE))) USEMODULE += luid USEMODULE += netif USEMODULE += ieee802154 - USEMODULE += netdev2_ieee802154 + USEMODULE += netdev_ieee802154 ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) # XXX: this can be modelled as a dependency for gnrc_netdev_default as soon - # as all drivers are ported to netdev2 - USEMODULE += gnrc_netdev2 + # as all drivers are ported to netdev + USEMODULE += gnrc_netdev endif FEATURES_REQUIRED += periph_gpio FEATURES_REQUIRED += periph_spi @@ -80,18 +80,18 @@ ifneq (,$(filter dht,$(USEMODULE))) endif ifneq (,$(filter enc28j60,$(USEMODULE))) - USEMODULE += netdev2_eth + USEMODULE += netdev_eth USEMODULE += xtimer USEMODULE += luid endif ifneq (,$(filter encx24j600,$(USEMODULE))) - USEMODULE += netdev2_eth + USEMODULE += netdev_eth USEMODULE += xtimer endif ifneq (,$(filter ethos,$(USEMODULE))) - USEMODULE += netdev2_eth + USEMODULE += netdev_eth USEMODULE += random USEMODULE += tsrb endif @@ -117,11 +117,11 @@ ifneq (,$(filter kw2xrf,$(USEMODULE))) USEMODULE += luid USEMODULE += netif USEMODULE += ieee802154 - USEMODULE += netdev2_ieee802154 + USEMODULE += netdev_ieee802154 ifneq (,$(filter gnrc_netdev_default,$(USEMODULE))) # XXX: this can be modelled as a dependency for gnrc_netdev_default as soon - # as all drivers are ported to netdev2 - USEMODULE += gnrc_netdev2 + # as all drivers are ported to netdev + USEMODULE += gnrc_netdev endif endif @@ -190,7 +190,7 @@ ifneq (,$(filter veml6070,$(USEMODULE))) endif ifneq (,$(filter w5100,$(USEMODULE))) - USEMODULE += netdev2_eth + USEMODULE += netdev_eth USEMODULE += luid endif diff --git a/drivers/at86rf2xx/at86rf2xx.c b/drivers/at86rf2xx/at86rf2xx.c index b77193548b..6e48bd5c41 100644 --- a/drivers/at86rf2xx/at86rf2xx.c +++ b/drivers/at86rf2xx/at86rf2xx.c @@ -38,7 +38,7 @@ void at86rf2xx_setup(at86rf2xx_t *dev, const at86rf2xx_params_t *params) { - netdev2_t *netdev = (netdev2_t *)dev; + netdev_t *netdev = (netdev_t *)dev; netdev->driver = &at86rf2xx_driver; /* initialize device descriptor */ @@ -161,7 +161,7 @@ size_t at86rf2xx_tx_load(at86rf2xx_t *dev, uint8_t *data, void at86rf2xx_tx_exec(at86rf2xx_t *dev) { - netdev2_t *netdev = (netdev2_t *)dev; + netdev_t *netdev = (netdev_t *)dev; /* write frame length field in FIFO */ at86rf2xx_sram_write(dev, 0, &(dev->tx_frame_len), 1); @@ -170,6 +170,6 @@ void at86rf2xx_tx_exec(at86rf2xx_t *dev) AT86RF2XX_TRX_STATE__TX_START); if (netdev->event_callback && (dev->netdev.flags & AT86RF2XX_OPT_TELL_TX_START)) { - netdev->event_callback(netdev, NETDEV2_EVENT_TX_STARTED); + netdev->event_callback(netdev, NETDEV_EVENT_TX_STARTED); } } diff --git a/drivers/at86rf2xx/at86rf2xx_netdev.c b/drivers/at86rf2xx/at86rf2xx_netdev.c index 4476ea4891..8528399c67 100644 --- a/drivers/at86rf2xx/at86rf2xx_netdev.c +++ b/drivers/at86rf2xx/at86rf2xx_netdev.c @@ -27,8 +27,8 @@ #include "net/eui64.h" #include "net/ieee802154.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #include "at86rf2xx.h" #include "at86rf2xx_netdev.h" @@ -40,14 +40,14 @@ #define _MAX_MHR_OVERHEAD (25) -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count); -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info); -static int _init(netdev2_t *netdev); -static void _isr(netdev2_t *netdev); -static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len); -static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len); +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count); +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); +static int _init(netdev_t *netdev); +static void _isr(netdev_t *netdev); +static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len); +static int _set(netdev_t *netdev, netopt_t opt, void *val, size_t len); -const netdev2_driver_t at86rf2xx_driver = { +const netdev_driver_t at86rf2xx_driver = { .send = _send, .recv = _recv, .init = _init, @@ -58,14 +58,14 @@ const netdev2_driver_t at86rf2xx_driver = { static void _irq_handler(void *arg) { - netdev2_t *dev = (netdev2_t *) arg; + netdev_t *dev = (netdev_t *) arg; if (dev->event_callback) { - dev->event_callback(dev, NETDEV2_EVENT_ISR); + dev->event_callback(dev, NETDEV_EVENT_ISR); } } -static int _init(netdev2_t *netdev) +static int _init(netdev_t *netdev) { at86rf2xx_t *dev = (at86rf2xx_t *)netdev; @@ -96,7 +96,7 @@ static int _init(netdev2_t *netdev) return 0; } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { at86rf2xx_t *dev = (at86rf2xx_t *)netdev; const struct iovec *ptr = vector; @@ -126,7 +126,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) return (int)len; } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { at86rf2xx_t *dev = (at86rf2xx_t *)netdev; uint8_t phr; @@ -166,7 +166,7 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) (void)tmp; if (info != NULL) { - netdev2_ieee802154_rx_info_t *radio_info = info; + netdev_ieee802154_rx_info_t *radio_info = info; at86rf2xx_fb_read(dev, &(radio_info->lqi), 1); #ifndef MODULE_AT86RF231 at86rf2xx_fb_read(dev, &(radio_info->rssi), 1); @@ -222,7 +222,7 @@ netopt_state_t _get_state(at86rf2xx_t *dev) } } -static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) +static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len) { at86rf2xx_t *dev = (at86rf2xx_t *) netdev; @@ -298,7 +298,7 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) int res; - if (((res = netdev2_ieee802154_get((netdev2_ieee802154_t *)netdev, opt, val, + if (((res = netdev_ieee802154_get((netdev_ieee802154_t *)netdev, opt, val, max_len)) >= 0) || (res != -ENOTSUP)) { return res; } @@ -349,7 +349,7 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) return res; } -static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) +static int _set(netdev_t *netdev, netopt_t opt, void *val, size_t len) { at86rf2xx_t *dev = (at86rf2xx_t *) netdev; uint8_t old_state = at86rf2xx_get_status(dev); @@ -368,17 +368,17 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) case NETOPT_ADDRESS: assert(len <= sizeof(uint16_t)); at86rf2xx_set_addr_short(dev, *((uint16_t *)val)); - /* don't set res to set netdev2_ieee802154_t::short_addr */ + /* don't set res to set netdev_ieee802154_t::short_addr */ break; case NETOPT_ADDRESS_LONG: assert(len <= sizeof(uint64_t)); at86rf2xx_set_addr_long(dev, *((uint64_t *)val)); - /* don't set res to set netdev2_ieee802154_t::long_addr */ + /* don't set res to set netdev_ieee802154_t::long_addr */ break; case NETOPT_NID: assert(len <= sizeof(uint16_t)); at86rf2xx_set_pan(dev, *((uint16_t *)val)); - /* don't set res to set netdev2_ieee802154_t::pan */ + /* don't set res to set netdev_ieee802154_t::pan */ break; case NETOPT_CHANNEL: assert(len != sizeof(uint8_t)); @@ -389,7 +389,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) break; } at86rf2xx_set_chan(dev, chan); - /* don't set res to set netdev2_ieee802154_t::chan */ + /* don't set res to set netdev_ieee802154_t::chan */ break; case NETOPT_CHANNEL_PAGE: @@ -428,7 +428,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) case NETOPT_AUTOACK: at86rf2xx_set_option(dev, AT86RF2XX_OPT_AUTOACK, ((bool *)val)[0]); - /* don't set res to set netdev2_ieee802154_t::flags */ + /* don't set res to set netdev_ieee802154_t::flags */ break; case NETOPT_RETRANS: @@ -509,14 +509,14 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) } if (res == -ENOTSUP) { - res = netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, opt, + res = netdev_ieee802154_set((netdev_ieee802154_t *)netdev, opt, val, len); } return res; } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { at86rf2xx_t *dev = (at86rf2xx_t *) netdev; uint8_t irq_mask; @@ -538,7 +538,7 @@ static void _isr(netdev2_t *netdev) AT86RF2XX_TRX_STATE_MASK__TRAC; if (irq_mask & AT86RF2XX_IRQ_STATUS_MASK__RX_START) { - netdev->event_callback(netdev, NETDEV2_EVENT_RX_STARTED); + netdev->event_callback(netdev, NETDEV_EVENT_RX_STARTED); DEBUG("[at86rf2xx] EVT - RX_START\n"); } @@ -549,7 +549,7 @@ static void _isr(netdev2_t *netdev) if (!(dev->netdev.flags & AT86RF2XX_OPT_TELL_RX_END)) { return; } - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } else if (state == AT86RF2XX_STATE_TX_ARET_ON || state == AT86RF2XX_STATE_BUSY_TX_ARET) { @@ -567,15 +567,15 @@ static void _isr(netdev2_t *netdev) switch (trac_status) { case AT86RF2XX_TRX_STATE__TRAC_SUCCESS: case AT86RF2XX_TRX_STATE__TRAC_SUCCESS_DATA_PENDING: - netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); DEBUG("[at86rf2xx] TX SUCCESS\n"); break; case AT86RF2XX_TRX_STATE__TRAC_NO_ACK: - netdev->event_callback(netdev, NETDEV2_EVENT_TX_NOACK); + netdev->event_callback(netdev, NETDEV_EVENT_TX_NOACK); DEBUG("[at86rf2xx] TX NO_ACK\n"); break; case AT86RF2XX_TRX_STATE__TRAC_CHANNEL_ACCESS_FAILURE: - netdev->event_callback(netdev, NETDEV2_EVENT_TX_MEDIUM_BUSY); + netdev->event_callback(netdev, NETDEV_EVENT_TX_MEDIUM_BUSY); DEBUG("[at86rf2xx] TX_CHANNEL_ACCESS_FAILURE\n"); break; default: diff --git a/drivers/at86rf2xx/include/at86rf2xx_netdev.h b/drivers/at86rf2xx/include/at86rf2xx_netdev.h index cb4a844c41..1765333fae 100644 --- a/drivers/at86rf2xx/include/at86rf2xx_netdev.h +++ b/drivers/at86rf2xx/include/at86rf2xx_netdev.h @@ -19,7 +19,7 @@ #ifndef AT86RF2XX_NETDEV_H #define AT86RF2XX_NETDEV_H -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -28,7 +28,7 @@ extern "C" { /** * @brief Reference to the netdev device driver struct */ -extern const netdev2_driver_t at86rf2xx_driver; +extern const netdev_driver_t at86rf2xx_driver; #ifdef __cplusplus } diff --git a/drivers/cc110x/cc110x-netdev2.c b/drivers/cc110x/cc110x-netdev.c similarity index 67% rename from drivers/cc110x/cc110x-netdev2.c rename to drivers/cc110x/cc110x-netdev.c index e7c862acc4..9c714d5d15 100644 --- a/drivers/cc110x/cc110x-netdev2.c +++ b/drivers/cc110x/cc110x-netdev.c @@ -11,7 +11,7 @@ * @ingroup drivers_cc110x * @{ * @file - * @brief Implementation of netdev2 interface for cc110x + * @brief Implementation of netdev interface for cc110x * * @author Fabian Nack * @author Kaspar Schleiser @@ -24,33 +24,33 @@ #include #include "cc110x.h" -#include "cc110x-netdev2.h" +#include "cc110x-netdev.h" #include "cc110x-internal.h" #include "cc110x-interface.h" #include "net/eui64.h" #include "periph/gpio.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/gnrc/nettype.h" #define ENABLE_DEBUG (0) #include "debug.h" -static int _send(netdev2_t *dev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *dev, const struct iovec *vector, unsigned count) { DEBUG("%s:%u\n", __func__, __LINE__); - netdev2_cc110x_t *netdev2_cc110x = (netdev2_cc110x_t*) dev; + netdev_cc110x_t *netdev_cc110x = (netdev_cc110x_t*) dev; cc110x_pkt_t *cc110x_pkt = vector[0].iov_base; - return cc110x_send(&netdev2_cc110x->cc110x, cc110x_pkt); + return cc110x_send(&netdev_cc110x->cc110x, cc110x_pkt); } -static int _recv(netdev2_t *dev, void *buf, size_t len, void *info) +static int _recv(netdev_t *dev, void *buf, size_t len, void *info) { DEBUG("%s:%u\n", __func__, __LINE__); - cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x; + cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x; cc110x_pkt_t *cc110x_pkt = &cc110x->pkt_buf.packet; if (cc110x_pkt->length > len) { @@ -59,7 +59,7 @@ static int _recv(netdev2_t *dev, void *buf, size_t len, void *info) memcpy(buf, (void*)cc110x_pkt, cc110x_pkt->length); if (info != NULL) { - netdev2_cc110x_rx_info_t *cc110x_info = info; + netdev_cc110x_rx_info_t *cc110x_info = info; cc110x_info->rssi = cc110x->pkt_buf.rssi; cc110x_info->lqi = cc110x->pkt_buf.lqi; @@ -67,9 +67,9 @@ static int _recv(netdev2_t *dev, void *buf, size_t len, void *info) return cc110x_pkt->length; } -static inline int _get_iid(netdev2_t *netdev, eui64_t *value, size_t max_len) +static inline int _get_iid(netdev_t *netdev, eui64_t *value, size_t max_len) { - cc110x_t *cc110x = &((netdev2_cc110x_t*) netdev)->cc110x; + cc110x_t *cc110x = &((netdev_cc110x_t*) netdev)->cc110x; uint8_t *eui64 = (uint8_t*) value; if (max_len < sizeof(eui64_t)) { @@ -85,14 +85,14 @@ static inline int _get_iid(netdev2_t *netdev, eui64_t *value, size_t max_len) return sizeof(eui64_t); } -static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t value_len) +static int _get(netdev_t *dev, netopt_t opt, void *value, size_t value_len) { - cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x; + cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x; switch (opt) { case NETOPT_DEVICE_TYPE: assert(value_len == 2); - *((uint16_t *) value) = NETDEV2_TYPE_CC110X; + *((uint16_t *) value) = NETDEV_TYPE_CC110X; return 2; #ifdef MODULE_GNRC_NETIF case NETOPT_PROTO: @@ -121,9 +121,9 @@ static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t value_len) return -ENOTSUP; } -static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len) +static int _set(netdev_t *dev, netopt_t opt, void *value, size_t value_len) { - cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x; + cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x; switch (opt) { case NETOPT_CHANNEL: @@ -164,34 +164,34 @@ static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len) return 0; } -static void _netdev2_cc110x_isr(void *arg) +static void _netdev_cc110x_isr(void *arg) { - netdev2_t *netdev2 = (netdev2_t*) arg; - netdev2->event_callback(netdev2, NETDEV2_EVENT_ISR); + netdev_t *netdev = (netdev_t*) arg; + netdev->event_callback(netdev, NETDEV_EVENT_ISR); } -static void _netdev2_cc110x_rx_callback(void *arg) +static void _netdev_cc110x_rx_callback(void *arg) { - netdev2_t *netdev2 = (netdev2_t*) arg; - cc110x_t *cc110x = &((netdev2_cc110x_t*) arg)->cc110x; + netdev_t *netdev = (netdev_t*) arg; + cc110x_t *cc110x = &((netdev_cc110x_t*) arg)->cc110x; gpio_irq_disable(cc110x->params.gdo2); - netdev2->event_callback(netdev2, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } -static void _isr(netdev2_t *dev) +static void _isr(netdev_t *dev) { - cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x; - cc110x_isr_handler(cc110x, _netdev2_cc110x_rx_callback, (void*)dev); + cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x; + cc110x_isr_handler(cc110x, _netdev_cc110x_rx_callback, (void*)dev); } -static int _init(netdev2_t *dev) +static int _init(netdev_t *dev) { DEBUG("%s:%u\n", __func__, __LINE__); - cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x; + cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x; gpio_init_int(cc110x->params.gdo2, GPIO_IN, GPIO_BOTH, - &_netdev2_cc110x_isr, (void*)dev); + &_netdev_cc110x_isr, (void*)dev); gpio_set(cc110x->params.gdo2); gpio_irq_disable(cc110x->params.gdo2); @@ -202,7 +202,7 @@ static int _init(netdev2_t *dev) return 0; } -const netdev2_driver_t netdev2_cc110x_driver = { +const netdev_driver_t netdev_cc110x_driver = { .send=_send, .recv=_recv, .init=_init, @@ -211,19 +211,19 @@ const netdev2_driver_t netdev2_cc110x_driver = { .isr=_isr }; -int netdev2_cc110x_setup(netdev2_cc110x_t *netdev2_cc110x, const cc110x_params_t *params) +int netdev_cc110x_setup(netdev_cc110x_t *netdev_cc110x, const cc110x_params_t *params) { - DEBUG("netdev2_cc110x_setup()\n"); - netdev2_cc110x->netdev.driver = &netdev2_cc110x_driver; + DEBUG("netdev_cc110x_setup()\n"); + netdev_cc110x->netdev.driver = &netdev_cc110x_driver; /* set default protocol */ #ifdef MODULE_GNRC_NETIF # ifdef MODULE_GNRC_SIXLOWPAN - netdev2_cc110x->cc110x.proto = GNRC_NETTYPE_SIXLOWPAN; + netdev_cc110x->cc110x.proto = GNRC_NETTYPE_SIXLOWPAN; # else - netdev2_cc110x->cc110x.proto = GNRC_NETTYPE_UNDEF; + netdev_cc110x->cc110x.proto = GNRC_NETTYPE_UNDEF; # endif #endif - return cc110x_setup(&netdev2_cc110x->cc110x, params); + return cc110x_setup(&netdev_cc110x->cc110x, params); } diff --git a/drivers/cc110x/gnrc_cc110x/gnrc_netdev2_cc110x.c b/drivers/cc110x/gnrc_cc110x/gnrc_netdev_cc110x.c similarity index 81% rename from drivers/cc110x/gnrc_cc110x/gnrc_netdev2_cc110x.c rename to drivers/cc110x/gnrc_cc110x/gnrc_netdev_cc110x.c index 869a95f5e3..cce2cf38d7 100644 --- a/drivers/cc110x/gnrc_cc110x/gnrc_netdev2_cc110x.c +++ b/drivers/cc110x/gnrc_cc110x/gnrc_netdev_cc110x.c @@ -10,25 +10,25 @@ #include -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/gnrc.h" #include "cc110x.h" -#include "cc110x-netdev2.h" -#include "net/gnrc/netdev2.h" +#include "cc110x-netdev.h" +#include "net/gnrc/netdev.h" #include "od.h" #define ENABLE_DEBUG (0) #include "debug.h" -static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netdev_t *gnrc_netdev, gnrc_pktsnip_t *pkt) { cc110x_pkt_t cc110x_pkt; - netdev2_t *dev = gnrc_netdev2->dev; - netdev2_cc110x_t *netdev_cc110x = (netdev2_cc110x_t *) dev; + netdev_t *dev = gnrc_netdev->dev; + netdev_cc110x_t *netdev_cc110x = (netdev_cc110x_t *) dev; cc110x_t *cc110x = &netdev_cc110x->cc110x; assert(pkt != NULL); - assert(dev->driver == &netdev2_cc110x_driver); + assert(dev->driver == &netdev_cc110x_driver); gnrc_netif_hdr_t *netif_hdr; gnrc_pktsnip_t *payload; @@ -36,7 +36,7 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) payload = pkt->next; if (pkt->type != GNRC_NETTYPE_NETIF) { - DEBUG("gnrc_netdev2_cc110x: First header was not generic netif header\n"); + DEBUG("gnrc_netdev_cc110x: First header was not generic netif header\n"); gnrc_pktbuf_release(pkt); return -EBADMSG; } @@ -82,7 +82,7 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) payload_len += payload->size; if (payload_len > CC110X_MAX_DATA_LENGTH) { - DEBUG("gnrc_netdev2_cc110x: payload length exceeds maximum" + DEBUG("gnrc_netdev_cc110x: payload length exceeds maximum" "(%u>%u)\n", payload_len, CC110X_MAX_DATA_LENGTH); gnrc_pktbuf_release(pkt); return -EBADMSG; @@ -98,7 +98,7 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) cc110x_pkt.length = (uint8_t) payload_len + CC110X_HEADER_LENGTH; - DEBUG("gnrc_netdev2_cc110x: sending packet from %u to %u with payload " + DEBUG("gnrc_netdev_cc110x: sending packet from %u to %u with payload " "length %u\n", (unsigned)cc110x_pkt.phy_src, (unsigned)cc110x_pkt.address, @@ -107,10 +107,10 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) return dev->driver->send(dev, &vector, 1); } -static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) +static gnrc_pktsnip_t *_recv(gnrc_netdev_t *gnrc_netdev) { - netdev2_t *dev = gnrc_netdev2->dev; - cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x; + netdev_t *dev = gnrc_netdev->dev; + cc110x_t *cc110x = &((netdev_cc110x_t*) dev)->cc110x; cc110x_pkt_t *cc110x_pkt = &cc110x->pkt_buf.packet; @@ -147,7 +147,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) GNRC_NETTYPE_NETIF); if (netif_hdr == NULL) { - DEBUG("gnrc_netdev2_cc110x: no space left in packet buffer\n"); + DEBUG("gnrc_netdev_cc110x: no space left in packet buffer\n"); gnrc_pktbuf_release(pkt); return NULL; } @@ -168,7 +168,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) ((gnrc_netif_hdr_t *)netif_hdr->data)->lqi = cc110x->pkt_buf.lqi; ((gnrc_netif_hdr_t *)netif_hdr->data)->rssi = cc110x->pkt_buf.rssi; - DEBUG("gnrc_netdev2_cc110x: received packet from %02x" + DEBUG("gnrc_netdev_cc110x: received packet from %02x" " of length %u\n", (unsigned)cc110x_pkt->phy_src, (unsigned)cc110x_pkt->length-CC110X_HEADER_LENGTH); @@ -182,11 +182,11 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) return pkt; } -int gnrc_netdev2_cc110x_init(gnrc_netdev2_t *gnrc_netdev2, netdev2_t *dev) +int gnrc_netdev_cc110x_init(gnrc_netdev_t *gnrc_netdev, netdev_t *dev) { - gnrc_netdev2->send = _send; - gnrc_netdev2->recv = _recv; - gnrc_netdev2->dev = dev; + gnrc_netdev->send = _send; + gnrc_netdev->recv = _recv; + gnrc_netdev->dev = dev; return 0; } diff --git a/drivers/cc110x/include/cc110x-netdev2.h b/drivers/cc110x/include/cc110x-netdev.h similarity index 61% rename from drivers/cc110x/include/cc110x-netdev2.h rename to drivers/cc110x/include/cc110x-netdev.h index 97981dc23a..43e39e1155 100644 --- a/drivers/cc110x/include/cc110x-netdev2.h +++ b/drivers/cc110x/include/cc110x-netdev.h @@ -12,7 +12,7 @@ * @{ * * @file - * @brief Variables for the cc110x netdev2 interface + * @brief Variables for the cc110x netdev interface * * @author Fabian Nack * @author Kaspar Schleiser @@ -23,7 +23,7 @@ #include "periph/gpio.h" #include "periph/spi.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "cc110x.h" #ifdef __cplusplus @@ -31,33 +31,33 @@ extern "C" { #endif /** - * @brief Implementation of netdev2_driver_t for CC110X device + * @brief Implementation of netdev_driver_t for CC110X device */ -extern const netdev2_driver_t netdev2_cc110x_driver; +extern const netdev_driver_t netdev_cc110x_driver; /** - * @brief cc110x netdev2 struct + * @brief cc110x netdev struct */ -typedef struct netdev2_cc110x { - netdev2_t netdev; /**< writing obious */ +typedef struct netdev_cc110x { + netdev_t netdev; /**< writing obious */ cc110x_t cc110x; /**< documentation here */ -} netdev2_cc110x_t; +} netdev_cc110x_t; /** * @brief Received packet status information for cc110x radios */ -typedef struct netdev2_radio_rx_info netdev2_cc110x_rx_info_t; +typedef struct netdev_radio_rx_info netdev_cc110x_rx_info_t; /** - * @brief netdev2 <-> cc110x glue code initialization function + * @brief netdev <-> cc110x glue code initialization function * - * @param[out] netdev2_cc110x ptr to netdev2_cc110x struct ti initialize + * @param[out] netdev_cc110x ptr to netdev_cc110x struct ti initialize * @param[in] params cc110x IO parameter struct to use * * @return 0 on success * @return -1 on error */ -int netdev2_cc110x_setup(netdev2_cc110x_t *netdev2_cc110x, const cc110x_params_t *params); +int netdev_cc110x_setup(netdev_cc110x_t *netdev_cc110x, const cc110x_params_t *params); #ifdef __cplusplus } diff --git a/drivers/cc110x/include/gnrc_netdev2_cc110x.h b/drivers/cc110x/include/gnrc_netdev_cc110x.h similarity index 77% rename from drivers/cc110x/include/gnrc_netdev2_cc110x.h rename to drivers/cc110x/include/gnrc_netdev_cc110x.h index e21a42d7fb..9e900075a7 100644 --- a/drivers/cc110x/include/gnrc_netdev2_cc110x.h +++ b/drivers/cc110x/include/gnrc_netdev_cc110x.h @@ -16,8 +16,8 @@ * @author Kaspar Schleiser */ -#include "net/gnrc/netdev2.h" -#include "cc110x-netdev2.h" +#include "net/gnrc/netdev.h" +#include "cc110x-netdev.h" #ifndef GNRC_CC110X_H #define GNRC_CC110X_H @@ -29,13 +29,13 @@ extern "C" { /** * @brief initialize cc110x gnrc glue code * - * @param[in] gnrc_netdev2 gnrc_netdev2 state structure to initialize + * @param[in] gnrc_netdev gnrc_netdev state structure to initialize * @param[in] dev cc110x device structure to setup * * @return 1 on sucess * @return <=0 on error */ -int gnrc_netdev2_cc110x_init(gnrc_netdev2_t *gnrc_netdev2, netdev2_cc110x_t *dev); +int gnrc_netdev_cc110x_init(gnrc_netdev_t *gnrc_netdev, netdev_cc110x_t *dev); #ifdef __cplusplus } diff --git a/drivers/cc2420/cc2420.c b/drivers/cc2420/cc2420.c index 4dd4a195f0..bb7ce3d5ce 100644 --- a/drivers/cc2420/cc2420.c +++ b/drivers/cc2420/cc2420.c @@ -160,7 +160,7 @@ void cc2420_tx_exec(cc2420_t *dev) /* trigger the transmission */ if (dev->options & CC2420_OPT_TELL_TX_START) { dev->netdev.netdev.event_callback(&dev->netdev.netdev, - NETDEV2_EVENT_TX_STARTED); + NETDEV_EVENT_TX_STARTED); } DEBUG("cc2420: tx_exec: TX_START\n"); if (dev->options & CC2420_OPT_CSMA) { diff --git a/drivers/cc2420/cc2420_netdev.c b/drivers/cc2420/cc2420_netdev.c index c3bf61e918..2172669fcf 100644 --- a/drivers/cc2420/cc2420_netdev.c +++ b/drivers/cc2420/cc2420_netdev.c @@ -26,8 +26,8 @@ #include "net/eui64.h" #include "net/ieee802154.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #include "xtimer.h" #include "cc2420.h" @@ -39,14 +39,14 @@ #include "debug.h" -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count); -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info); -static int _init(netdev2_t *netdev); -static void _isr(netdev2_t *netdev); -static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len); -static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len); +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count); +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); +static int _init(netdev_t *netdev); +static void _isr(netdev_t *netdev); +static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len); +static int _set(netdev_t *netdev, netopt_t opt, void *val, size_t len); -const netdev2_driver_t cc2420_driver = { +const netdev_driver_t cc2420_driver = { .send = _send, .recv = _recv, .init = _init, @@ -57,10 +57,10 @@ const netdev2_driver_t cc2420_driver = { static void _irq_handler(void *arg) { - netdev2_t *dev = (netdev2_t *)arg; + netdev_t *dev = (netdev_t *)arg; if(dev->event_callback) { - dev->event_callback(dev, NETDEV2_EVENT_ISR); + dev->event_callback(dev, NETDEV_EVENT_ISR); } } @@ -97,7 +97,7 @@ static inline int opt_state(void *buf, bool cond) return sizeof(netopt_enable_t); } -static int _init(netdev2_t *netdev) +static int _init(netdev_t *netdev) { cc2420_t *dev = (cc2420_t *)netdev; @@ -145,24 +145,24 @@ static int _init(netdev2_t *netdev) return cc2420_init((cc2420_t *)dev); } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { cc2420_t *dev = (cc2420_t *)netdev; return (int)cc2420_send(dev, vector, count); } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { cc2420_t *dev = (cc2420_t *)netdev; return (int)cc2420_rx(dev, buf, len, info); } -static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) +static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len) { if (netdev == NULL) { return -ENODEV; @@ -170,7 +170,7 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) cc2420_t *dev = (cc2420_t *)netdev; - int ext = netdev2_ieee802154_get(&dev->netdev, opt, val, max_len); + int ext = netdev_ieee802154_get(&dev->netdev, opt, val, max_len); if (ext > 0) { return ext; } @@ -236,7 +236,7 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) } } -static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t val_len) +static int _set(netdev_t *netdev, netopt_t opt, void *val, size_t val_len) { if (netdev == NULL) { return -ENODEV; @@ -244,7 +244,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t val_len) cc2420_t *dev = (cc2420_t *)netdev; - int ext = netdev2_ieee802154_set(&dev->netdev, opt, val, val_len); + int ext = netdev_ieee802154_set(&dev->netdev, opt, val, val_len); switch (opt) { case NETOPT_ADDRESS: diff --git a/drivers/cc2420/include/cc2420_netdev.h b/drivers/cc2420/include/cc2420_netdev.h index fb4a5eb8ac..36220e6c96 100644 --- a/drivers/cc2420/include/cc2420_netdev.h +++ b/drivers/cc2420/include/cc2420_netdev.h @@ -22,7 +22,7 @@ #ifndef CC2420_NETDEV_H #define CC2420_NETDEV_H -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -31,7 +31,7 @@ extern "C" { /** * @brief Reference to the netdev device driver struct */ -extern const netdev2_driver_t cc2420_driver; +extern const netdev_driver_t cc2420_driver; #ifdef __cplusplus } diff --git a/drivers/enc28j60/enc28j60.c b/drivers/enc28j60/enc28j60.c index f43c4f34b7..7965de9882 100644 --- a/drivers/enc28j60/enc28j60.c +++ b/drivers/enc28j60/enc28j60.c @@ -26,7 +26,7 @@ #include "xtimer.h" #include "assert.h" #include "net/ethernet.h" -#include "net/netdev2/eth.h" +#include "net/netdev/eth.h" #include "enc28j60.h" #include "enc28j60_regs.h" @@ -236,11 +236,11 @@ static void mac_set(enc28j60_t *dev, uint8_t *mac) static void on_int(void *arg) { - netdev2_t *netdev = (netdev2_t *)arg; - netdev->event_callback(arg, NETDEV2_EVENT_ISR); + netdev_t *netdev = (netdev_t *)arg; + netdev->event_callback(arg, NETDEV_EVENT_ISR); } -static int nd_send(netdev2_t *netdev, const struct iovec *data, unsigned count) +static int nd_send(netdev_t *netdev, const struct iovec *data, unsigned count) { enc28j60_t *dev = (enc28j60_t *)netdev; uint8_t ctrl = 0; @@ -269,7 +269,7 @@ static int nd_send(netdev2_t *netdev, const struct iovec *data, unsigned count) return c; } -static int nd_recv(netdev2_t *netdev, void *buf, size_t max_len, void *info) +static int nd_recv(netdev_t *netdev, void *buf, size_t max_len, void *info) { enc28j60_t *dev = (enc28j60_t *)netdev; uint8_t head[6]; @@ -308,7 +308,7 @@ static int nd_recv(netdev2_t *netdev, void *buf, size_t max_len, void *info) return (int)size; } -static int nd_init(netdev2_t *netdev) +static int nd_init(netdev_t *netdev) { enc28j60_t *dev = (enc28j60_t *)netdev; int res; @@ -402,7 +402,7 @@ static int nd_init(netdev2_t *netdev) return 0; } -static void nd_isr(netdev2_t *netdev) +static void nd_isr(netdev_t *netdev) { enc28j60_t *dev = (enc28j60_t *)netdev; uint8_t eir = cmd_rcr(dev, REG_EIR, -1); @@ -414,17 +414,17 @@ static void nd_isr(netdev2_t *netdev) /* go and tell the new link layer state to upper layers */ if (cmd_r_phy(dev, REG_PHY_PHSTAT2) & PHSTAT2_LSTAT) { DEBUG("[enc28j60] isr: link up!\n"); - netdev->event_callback(netdev, NETDEV2_EVENT_LINK_UP); + netdev->event_callback(netdev, NETDEV_EVENT_LINK_UP); } else { DEBUG("[enc28j60] isr: link down!\n"); - netdev->event_callback(netdev, NETDEV2_EVENT_LINK_DOWN); + netdev->event_callback(netdev, NETDEV_EVENT_LINK_DOWN); } } if (eir & EIR_PKTIF) { do { DEBUG("[enc28j60] isr: packet received\n"); - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } while (cmd_rcr(dev, REG_B1_EPKTCNT, 1) > 0); } if (eir & EIR_RXERIF) { @@ -433,7 +433,7 @@ static void nd_isr(netdev2_t *netdev) } if (eir & EIR_TXIF) { DEBUG("[enc28j60] isr: packet transmitted\n"); - netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); cmd_bfc(dev, REG_EIR, -1, EIR_TXIF); } if (eir & EIR_TXERIF) { @@ -444,7 +444,7 @@ static void nd_isr(netdev2_t *netdev) } } -static int nd_get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) +static int nd_get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len) { enc28j60_t *dev = (enc28j60_t *)netdev; @@ -454,11 +454,11 @@ static int nd_get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) mac_get(dev, (uint8_t *)value); return ETHERNET_ADDR_LEN; default: - return netdev2_eth_get(netdev, opt, value, max_len); + return netdev_eth_get(netdev, opt, value, max_len); } } -static int nd_set(netdev2_t *netdev, netopt_t opt, void *value, size_t value_len) +static int nd_set(netdev_t *netdev, netopt_t opt, void *value, size_t value_len) { enc28j60_t *dev = (enc28j60_t *)netdev; @@ -468,11 +468,11 @@ static int nd_set(netdev2_t *netdev, netopt_t opt, void *value, size_t value_len mac_set(dev, (uint8_t *)value); return ETHERNET_ADDR_LEN; default: - return netdev2_eth_set(netdev, opt, value, value_len); + return netdev_eth_set(netdev, opt, value, value_len); } } -const static netdev2_driver_t netdev2_driver_enc28j60 = { +const static netdev_driver_t netdev_driver_enc28j60 = { .send = nd_send, .recv = nd_recv, .init = nd_init, @@ -483,7 +483,7 @@ const static netdev2_driver_t netdev2_driver_enc28j60 = { void enc28j60_setup(enc28j60_t *dev, const enc28j60_params_t *params) { - dev->netdev.driver = &netdev2_driver_enc28j60; + dev->netdev.driver = &netdev_driver_enc28j60; dev->spi = params->spi; dev->cs_pin = params->cs_pin; dev->int_pin = params->int_pin; diff --git a/drivers/encx24j600/encx24j600.c b/drivers/encx24j600/encx24j600.c index 44b17061ec..378d8c3d44 100644 --- a/drivers/encx24j600/encx24j600.c +++ b/drivers/encx24j600/encx24j600.c @@ -32,8 +32,8 @@ #include "encx24j600_defines.h" #include "xtimer.h" -#include "net/netdev2.h" -#include "net/netdev2/eth.h" +#include "net/netdev.h" +#include "net/netdev/eth.h" #include "net/eui64.h" #include "net/ethernet.h" #include "net/netstats.h" @@ -61,22 +61,22 @@ static uint16_t reg_get(encx24j600_t *dev, uint8_t reg); static void reg_clear_bits(encx24j600_t *dev, uint8_t reg, uint16_t mask); static inline int _packets_available(encx24j600_t *dev); -static void _get_mac_addr(netdev2_t *dev, uint8_t* buf); +static void _get_mac_addr(netdev_t *dev, uint8_t* buf); -/* netdev2 interface */ -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count); -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info); -static int _init(netdev2_t *dev); -static void _isr(netdev2_t *dev); -static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len); +/* netdev interface */ +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count); +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); +static int _init(netdev_t *dev); +static void _isr(netdev_t *dev); +static int _get(netdev_t *dev, netopt_t opt, void *value, size_t max_len); -const static netdev2_driver_t netdev2_driver_encx24j600 = { +const static netdev_driver_t netdev_driver_encx24j600 = { .send = _send, .recv = _recv, .init = _init, .isr = _isr, .get = _get, - .set = netdev2_eth_set, + .set = netdev_eth_set, }; static inline void lock(encx24j600_t *dev) { @@ -89,7 +89,7 @@ static inline void unlock(encx24j600_t *dev) { void encx24j600_setup(encx24j600_t *dev, const encx24j600_params_t *params) { - dev->netdev.driver = &netdev2_driver_encx24j600; + dev->netdev.driver = &netdev_driver_encx24j600; dev->spi = params->spi; dev->cs = params->cs_pin; dev->int_pin = params->int_pin; @@ -103,11 +103,11 @@ static void encx24j600_isr(void *arg) /* disable interrupt line */ gpio_irq_disable(dev->int_pin); - /* call netdev2 hook */ - dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_ISR); + /* call netdev hook */ + dev->netdev.event_callback((netdev_t*) dev, NETDEV_EVENT_ISR); } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { encx24j600_t *dev = (encx24j600_t *) netdev; @@ -122,9 +122,9 @@ static void _isr(netdev2_t *netdev) if (eir & ENC_LINKIF) { uint16_t estat = reg_get(dev, ENC_ESTAT); - netdev2_event_t event = (estat & ENC_PHYLNK) ? - NETDEV2_EVENT_LINK_DOWN : - NETDEV2_EVENT_LINK_UP; + netdev_event_t event = (estat & ENC_PHYLNK) ? + NETDEV_EVENT_LINK_DOWN : + NETDEV_EVENT_LINK_UP; netdev->event_callback(netdev, event); } @@ -133,7 +133,7 @@ static void _isr(netdev2_t *netdev) if (eir & ENC_PKTIF) { while (_packets_available(dev)) { unlock(dev); - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); lock(dev); } } @@ -233,7 +233,7 @@ static void sram_op(encx24j600_t *dev, uint16_t cmd, uint16_t addr, char *ptr, i cmdn(dev, cmd, in, out, len); } -static int _init(netdev2_t *encdev) +static int _init(netdev_t *encdev) { encx24j600_t *dev = (encx24j600_t *) encdev; @@ -291,7 +291,7 @@ static int _init(netdev2_t *encdev) return 0; } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) { +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { encx24j600_t * dev = (encx24j600_t *) netdev; lock(dev); @@ -332,7 +332,7 @@ static inline int _packets_available(encx24j600_t *dev) return reg_get(dev, ENC_ESTAT) & ~0xFF00; } -static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf) +static void _get_mac_addr(netdev_t *encdev, uint8_t* buf) { encx24j600_t * dev = (encx24j600_t *) encdev; uint16_t *addr = (uint16_t *) buf; @@ -346,7 +346,7 @@ static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf) unlock(dev); } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { encx24j600_t * dev = (encx24j600_t *) netdev; encx24j600_frame_hdr_t hdr; @@ -381,7 +381,7 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) return payload_len; } -static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) +static int _get(netdev_t *dev, netopt_t opt, void *value, size_t max_len) { int res = 0; @@ -396,7 +396,7 @@ static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) } break; default: - res = netdev2_eth_get(dev, opt, value, max_len); + res = netdev_eth_get(dev, opt, value, max_len); break; } diff --git a/drivers/ethos/ethos.c b/drivers/ethos/ethos.c index 8a2c2a680e..ea2cd91ede 100644 --- a/drivers/ethos/ethos.c +++ b/drivers/ethos/ethos.c @@ -28,8 +28,8 @@ #include "tsrb.h" #include "irq.h" -#include "net/netdev2.h" -#include "net/netdev2/eth.h" +#include "net/netdev.h" +#include "net/netdev/eth.h" #include "net/eui64.h" #include "net/ethernet.h" @@ -42,9 +42,9 @@ extern isrpipe_t uart_stdio_isrpipe; #define ENABLE_DEBUG (0) #include "debug.h" -static void _get_mac_addr(netdev2_t *dev, uint8_t* buf); +static void _get_mac_addr(netdev_t *dev, uint8_t* buf); static void ethos_isr(void *arg, uint8_t c); -static const netdev2_driver_t netdev2_driver_ethos; +static const netdev_driver_t netdev_driver_ethos; static const uint8_t _esc_esc[] = {ETHOS_ESC_CHAR, (ETHOS_ESC_CHAR ^ 0x20)}; static const uint8_t _esc_delim[] = {ETHOS_ESC_CHAR, (ETHOS_FRAME_DELIMITER ^ 0x20)}; @@ -52,7 +52,7 @@ static const uint8_t _esc_delim[] = {ETHOS_ESC_CHAR, (ETHOS_FRAME_DELIMITER ^ 0x void ethos_setup(ethos_t *dev, const ethos_params_t *params) { - dev->netdev.driver = &netdev2_driver_ethos; + dev->netdev.driver = &netdev_driver_ethos; dev->uart = params->uart; dev->state = WAIT_FRAMESTART; dev->framesize = 0; @@ -113,7 +113,7 @@ static void _end_of_frame(ethos_t *dev) case ETHOS_FRAME_TYPE_DATA: if (dev->framesize) { dev->last_framesize = dev->framesize; - dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_ISR); + dev->netdev.event_callback((netdev_t*) dev, NETDEV_EVENT_ISR); } break; case ETHOS_FRAME_TYPE_HELLO: @@ -176,13 +176,13 @@ static void ethos_isr(void *arg, uint8_t c) } } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { ethos_t *dev = (ethos_t *) netdev; - dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_RX_COMPLETE); + dev->netdev.event_callback((netdev_t*) dev, NETDEV_EVENT_RX_COMPLETE); } -static int _init(netdev2_t *encdev) +static int _init(netdev_t *encdev) { ethos_t *dev = (ethos_t *) encdev; (void)dev; @@ -256,7 +256,7 @@ void ethos_send_frame(ethos_t *dev, const uint8_t *data, size_t len, unsigned fr } } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { ethos_t * dev = (ethos_t *) netdev; (void)dev; @@ -288,13 +288,13 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) return pktlen; } -static void _get_mac_addr(netdev2_t *encdev, uint8_t* buf) +static void _get_mac_addr(netdev_t *encdev, uint8_t* buf) { ethos_t * dev = (ethos_t *) encdev; memcpy(buf, dev->mac_addr, 6); } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void* info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void* info) { (void) info; ethos_t * dev = (ethos_t *) netdev; @@ -320,7 +320,7 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void* info) } } -static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) +static int _get(netdev_t *dev, netopt_t opt, void *value, size_t max_len) { int res = 0; @@ -335,19 +335,19 @@ static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) } break; default: - res = netdev2_eth_get(dev, opt, value, max_len); + res = netdev_eth_get(dev, opt, value, max_len); break; } return res; } -/* netdev2 interface */ -static const netdev2_driver_t netdev2_driver_ethos = { +/* netdev interface */ +static const netdev_driver_t netdev_driver_ethos = { .send = _send, .recv = _recv, .init = _init, .isr = _isr, .get = _get, - .set = netdev2_eth_set + .set = netdev_eth_set }; diff --git a/drivers/include/at86rf2xx.h b/drivers/include/at86rf2xx.h index 834f99def4..3afee08987 100644 --- a/drivers/include/at86rf2xx.h +++ b/drivers/include/at86rf2xx.h @@ -35,8 +35,8 @@ #include "board.h" #include "periph/spi.h" #include "periph/gpio.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #include "net/gnrc/nettype.h" #ifdef __cplusplus @@ -110,13 +110,13 @@ extern "C" { * @brief Internal device option flags * * `0x00ff` is reserved for general IEEE 802.15.4 flags - * (see @ref netdev2_ieee802154_t) + * (see @ref netdev_ieee802154_t) * * @{ */ -#define AT86RF2XX_OPT_SRC_ADDR_LONG (NETDEV2_IEEE802154_SRC_MODE_LONG) /**< legacy define */ -#define AT86RF2XX_OPT_RAWDUMP (NETDEV2_IEEE802154_RAW) /**< legacy define */ -#define AT86RF2XX_OPT_AUTOACK (NETDEV2_IEEE802154_ACK_REQ) /**< legacy define */ +#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_CSMA (0x0100) /**< CSMA active */ #define AT86RF2XX_OPT_PROMISCUOUS (0x0200) /**< promiscuous mode @@ -147,10 +147,10 @@ typedef struct at86rf2xx_params { /** * @brief Device descriptor for AT86RF2XX radio devices * - * @extends netdev2_ieee802154_t + * @extends netdev_ieee802154_t */ typedef struct { - netdev2_ieee802154_t netdev; /**< netdev2 parent struct */ + netdev_ieee802154_t netdev; /**< netdev parent struct */ /** * @brief device specific fields * @{ diff --git a/drivers/include/cc2420.h b/drivers/include/cc2420.h index 61773456fb..9c02d90bd4 100644 --- a/drivers/include/cc2420.h +++ b/drivers/include/cc2420.h @@ -26,8 +26,8 @@ #include "periph/spi.h" #include "periph/gpio.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #ifdef __cplusplus extern "C" { @@ -91,7 +91,7 @@ typedef struct cc2420_params { */ typedef struct { /* netdev fields */ - netdev2_ieee802154_t netdev; /**< netdev2 parent struct */ + netdev_ieee802154_t netdev; /**< netdev parent struct */ /* device specific fields */ cc2420_params_t params; /**< hardware interface configuration */ /* device state fields */ diff --git a/drivers/include/enc28j60.h b/drivers/include/enc28j60.h index dd0c3f34c2..13427c09c8 100644 --- a/drivers/include/enc28j60.h +++ b/drivers/include/enc28j60.h @@ -26,7 +26,7 @@ #include "mutex.h" #include "periph/spi.h" #include "periph/gpio.h" -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -46,7 +46,7 @@ typedef struct { * @brief ENC28J60 device descriptor */ typedef struct { - netdev2_t netdev; /**< pull in the netdev2 fields */ + netdev_t netdev; /**< pull in the netdev fields */ spi_t spi; /**< SPI bus the transceiver is connected to */ gpio_t cs_pin; /**< pin connected to the CHIP SELECT line */ gpio_t int_pin; /**< pin connected to the INT line */ @@ -56,7 +56,7 @@ typedef struct { } enc28j60_t; /** - * @brief Ready the device for initialization through it's netdev2 interface + * @brief Ready the device for initialization through it's netdev interface * * @param[in] dev device descriptor * @param[in] params peripheral configuration to use diff --git a/drivers/include/encx24j600.h b/drivers/include/encx24j600.h index a4ab05c40e..158eb9fa5a 100644 --- a/drivers/include/encx24j600.h +++ b/drivers/include/encx24j600.h @@ -25,18 +25,18 @@ #include "kernel_types.h" #include "periph/spi.h" #include "periph/gpio.h" -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { #endif /** - * @brief encx24j600 netdev2 device - * @extends netdev2_t + * @brief encx24j600 netdev device + * @extends netdev_t */ typedef struct { - netdev2_t netdev; /**< extended netdev2 structure */ + netdev_t netdev; /**< extended netdev structure */ spi_t spi; /**< SPI device the enc is connected to*/ gpio_t cs; /**< SPI chip select pin */ gpio_t int_pin; /**< SPI interrupt pin */ diff --git a/drivers/include/ethos.h b/drivers/include/ethos.h index 3ea3ed801c..406e0346b1 100644 --- a/drivers/include/ethos.h +++ b/drivers/include/ethos.h @@ -23,7 +23,7 @@ #include "kernel_types.h" #include "periph/uart.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "tsrb.h" #include "mutex.h" @@ -64,11 +64,11 @@ typedef enum { } line_state_t; /** - * @brief ethos netdev2 device - * @extends netdev2_t + * @brief ethos netdev device + * @extends netdev_t */ typedef struct { - netdev2_t netdev; /**< extended netdev2 structure */ + netdev_t netdev; /**< extended netdev structure */ uart_t uart; /**< UART device the to use */ uint8_t mac_addr[6]; /**< this device's MAC address */ uint8_t remote_mac_addr[6]; /**< this device's MAC address */ diff --git a/drivers/include/kw2xrf.h b/drivers/include/kw2xrf.h index e7602e80b7..fe0571a4bd 100644 --- a/drivers/include/kw2xrf.h +++ b/drivers/include/kw2xrf.h @@ -28,8 +28,8 @@ #include "board.h" #include "periph/spi.h" #include "periph/gpio.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #include "net/gnrc/nettype.h" #ifdef __cplusplus @@ -84,13 +84,13 @@ extern "C" { * @brief Internal device option flags * * `0x00ff` is reserved for general IEEE 802.15.4 flags - * (see @ref netdev2_ieee802154_t) + * (see @ref netdev_ieee802154_t) * * @{ */ -#define KW2XRF_OPT_SRC_ADDR_LONG (NETDEV2_IEEE802154_SRC_MODE_LONG) /**< legacy define */ -#define KW2XRF_OPT_RAWDUMP (NETDEV2_IEEE802154_RAW) /**< legacy define */ -#define KW2XRF_OPT_ACK_REQ (NETDEV2_IEEE802154_ACK_REQ) /**< legacy define */ +#define KW2XRF_OPT_SRC_ADDR_LONG (NETDEV_IEEE802154_SRC_MODE_LONG) /**< legacy define */ +#define KW2XRF_OPT_RAWDUMP (NETDEV_IEEE802154_RAW) /**< legacy define */ +#define KW2XRF_OPT_ACK_REQ (NETDEV_IEEE802154_ACK_REQ) /**< legacy define */ #define KW2XRF_OPT_AUTOCCA (0x0100) /**< CCA befor TX active */ #define KW2XRF_OPT_PROMISCUOUS (0x0200) /**< promiscuous mode @@ -121,10 +121,10 @@ typedef struct kw2xrf_params { /** * @brief Device descriptor for KW2XRF radio devices * - * @extends netdev2_ieee802154_t + * @extends netdev_ieee802154_t */ typedef struct { - netdev2_ieee802154_t netdev; /**< netdev2 parent struct */ + netdev_ieee802154_t netdev; /**< netdev parent struct */ /** * @brief device specific fields * @{ diff --git a/drivers/include/mrf24j40.h b/drivers/include/mrf24j40.h index 210338a30b..c1bc6f5755 100644 --- a/drivers/include/mrf24j40.h +++ b/drivers/include/mrf24j40.h @@ -31,8 +31,8 @@ #include "board.h" #include "periph/spi.h" #include "periph/gpio.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #include "net/gnrc/nettype.h" #ifdef __cplusplus @@ -93,7 +93,7 @@ extern "C" { * @brief Internal device option flags * * `0x00ff` is reserved for general IEEE 802.15.4 flags - * (see @ref netdev2_ieee802154_t) + * (see @ref netdev_ieee802154_t) * * @{ */ @@ -135,7 +135,7 @@ typedef struct mrf24j40_params { * @brief Device descriptor for MRF24J40 radio devices */ typedef struct { - netdev2_ieee802154_t netdev; /**< netdev2 parent struct */ + netdev_ieee802154_t netdev; /**< netdev parent struct */ /** * @brief device specific fields * @{ diff --git a/drivers/include/net/netdev2.h b/drivers/include/net/netdev.h similarity index 69% rename from drivers/include/net/netdev2.h rename to drivers/include/net/netdev.h index b11e2e9374..46d9aa7caa 100644 --- a/drivers/include/net/netdev2.h +++ b/drivers/include/net/netdev.h @@ -10,7 +10,7 @@ */ /** - * @defgroup drivers_netdev_netdev2 Generic Low-Level Network Driver Interface v2 + * @defgroup drivers_netdev_api Network Device Driver API * @ingroup drivers_netdev * @brief This is the second version of a generic low-level network * driver interface @@ -22,16 +22,16 @@ * * 1. packet arrives for device * 2. The driver previously registered an ISR for handling received packets. - * This ISR then calls @ref netdev2_t::event_callback "netdev->event_callback()" - * with `event` := @ref NETDEV2_EVENT_ISR (from Interrupt Service Routine) + * This ISR then calls @ref netdev_t::event_callback "netdev->event_callback()" + * with `event` := @ref NETDEV_EVENT_ISR (from Interrupt Service Routine) * which wakes up event handler - * 3. event handler calls @ref netdev2_driver_t::isr "netdev2->driver->isr()" + * 3. event handler calls @ref netdev_driver_t::isr "netdev->driver->isr()" * (from thread context) - * 4. @ref netdev2_driver_t::isr "netdev->driver->isr()" calls - * @ref netdev2_t::event_callback "netdev->event_callback()" with - * `event` := @ref NETDEV2_EVENT_RX_COMPLETE - * 5. @ref netdev2_t::event_callback "netdev->event_callback()" uses - * @ref netdev2_driver_t::recv "netdev2->driver->recv()" to fetch packet + * 4. @ref netdev_driver_t::isr "netdev->driver->isr()" calls + * @ref netdev_t::event_callback "netdev->event_callback()" with + * `event` := @ref NETDEV_EVENT_RX_COMPLETE + * 5. @ref netdev_t::event_callback "netdev->event_callback()" uses + * @ref netdev_driver_t::recv "netdev->driver->recv()" to fetch packet * * ![RX event example](riot-netdev-rx.svg) * @@ -43,8 +43,8 @@ * @author Hauke Petersen */ -#ifndef NETDEV2_H -#define NETDEV2_H +#ifndef NETDEV_H +#define NETDEV_H #ifdef __cplusplus extern "C" { @@ -57,12 +57,12 @@ extern "C" { #include "net/netopt.h" enum { - NETDEV2_TYPE_UNKNOWN, - NETDEV2_TYPE_RAW, - NETDEV2_TYPE_ETHERNET, - NETDEV2_TYPE_IEEE802154, - NETDEV2_TYPE_CC110X, - NETDEV2_TYPE_NRFMIN + NETDEV_TYPE_UNKNOWN, + NETDEV_TYPE_RAW, + NETDEV_TYPE_ETHERNET, + NETDEV_TYPE_IEEE802154, + NETDEV_TYPE_CC110X, + NETDEV_TYPE_NRFMIN }; /** @@ -70,39 +70,39 @@ enum { * upper layer */ typedef enum { - NETDEV2_EVENT_ISR, /**< driver needs it's ISR handled */ - NETDEV2_EVENT_RX_STARTED, /**< started to receive a packet */ - NETDEV2_EVENT_RX_COMPLETE, /**< finished receiving a packet */ - NETDEV2_EVENT_TX_STARTED, /**< started to transfer a packet */ - NETDEV2_EVENT_TX_COMPLETE, /**< finished transferring packet */ - NETDEV2_EVENT_TX_NOACK, /**< ACK requested but not received */ - NETDEV2_EVENT_TX_MEDIUM_BUSY, /**< couldn't transfer packet */ - NETDEV2_EVENT_LINK_UP, /**< link established */ - NETDEV2_EVENT_LINK_DOWN, /**< link gone */ + NETDEV_EVENT_ISR, /**< driver needs it's ISR handled */ + NETDEV_EVENT_RX_STARTED, /**< started to receive a packet */ + NETDEV_EVENT_RX_COMPLETE, /**< finished receiving a packet */ + NETDEV_EVENT_TX_STARTED, /**< started to transfer a packet */ + NETDEV_EVENT_TX_COMPLETE, /**< finished transferring packet */ + NETDEV_EVENT_TX_NOACK, /**< ACK requested but not received */ + NETDEV_EVENT_TX_MEDIUM_BUSY, /**< couldn't transfer packet */ + NETDEV_EVENT_LINK_UP, /**< link established */ + NETDEV_EVENT_LINK_DOWN, /**< link gone */ /* expand this list if needed */ -} netdev2_event_t; +} netdev_event_t; /** * @brief Received packet status information for most radios * * May be different for certain radios. */ -struct netdev2_radio_rx_info { +struct netdev_radio_rx_info { uint8_t rssi; /**< RSSI of a received packet */ uint8_t lqi; /**< LQI of a received packet */ }; /** - * @brief Forward declaration for netdev2 struct + * @brief Forward declaration for netdev struct */ -typedef struct netdev2 netdev2_t; +typedef struct netdev netdev_t; /** * @brief Event callback for signaling event to upper layers * * @param[in] type type of the event */ -typedef void (*netdev2_event_cb_t)(netdev2_t *dev, netdev2_event_t event); +typedef void (*netdev_event_cb_t)(netdev_t *dev, netdev_event_t event); /** * @brief Structure to hold driver state @@ -113,9 +113,9 @@ typedef void (*netdev2_event_cb_t)(netdev2_t *dev, netdev2_event_t event); * Contains a field @p context which is not used by the drivers, but supposed to * be used by upper layers to store reference information. */ -struct netdev2 { - const struct netdev2_driver *driver; /**< ptr to that driver's interface. */ - netdev2_event_cb_t event_callback; /**< callback for device events */ +struct netdev { + const struct netdev_driver *driver; /**< ptr to that driver's interface. */ + netdev_event_cb_t event_callback; /**< callback for device events */ void* context; /**< ptr to network stack context */ #ifdef MODULE_NETSTATS_L2 netstats_t stats; /**< transceiver's statistics */ @@ -128,7 +128,7 @@ struct netdev2 { * The send/receive functions expect/return a full ethernet * frame (dst mac, src mac, ethertype, payload, no checksum). */ -typedef struct netdev2_driver { +typedef struct netdev_driver { /** * @brief Send frame * @@ -142,7 +142,7 @@ typedef struct netdev2_driver { * * @return number of bytes sent, or `< 0` on error */ - int (*send)(netdev2_t *dev, const struct iovec *vector, unsigned count); + int (*send)(netdev_t *dev, const struct iovec *vector, unsigned count); /** * @brief Get a received frame @@ -150,7 +150,7 @@ typedef struct netdev2_driver { * @pre `(dev != NULL)` * @pre `(buf != NULL) && (len > 0)` * - * Supposed to be called from @ref netdev2_t::event_callback(). + * Supposed to be called from @ref netdev_t::event_callback(). * * If buf == NULL and len == 0, returns the packet size without dropping it. * If buf == NULL and len > 0, drops the packet and returns the packet size. @@ -159,14 +159,14 @@ typedef struct netdev2_driver { * @param[out] buf buffer to write into or NULL * @param[in] len maximum number of bytes to read * @param[out] info status information for the received packet. Might - * be of different type for different netdev2 devices. + * be of different type for different netdev devices. * May be NULL if not needed or applicable. * * @return `< 0` on error * @return number of bytes read if buf != NULL * @return packet size if buf == NULL */ - int (*recv)(netdev2_t *dev, void *buf, size_t len, void *info); + int (*recv)(netdev_t *dev, void *buf, size_t len, void *info); /** * @brief the driver's initialization function @@ -175,7 +175,7 @@ typedef struct netdev2_driver { * * @return `< 0` on error, 0 on success */ - int (*init)(netdev2_t *dev); + int (*init)(netdev_t *dev); /** * @brief a driver's user-space ISR handler @@ -183,15 +183,15 @@ typedef struct netdev2_driver { * @pre `(dev != NULL)` * * This function will be called from a network stack's loop when being notified - * by netdev2_isr. + * by netdev_isr. * - * It is supposed to call @ref netdev2_t::event_callback() for each occuring event. + * It is supposed to call @ref netdev_t::event_callback() for each occuring event. * * See receive packet flow description for details. * * @param[in] dev network device descriptor */ - void (*isr)(netdev2_t *dev); + void (*isr)(netdev_t *dev); /** * @brief Get an option value from a given network device @@ -206,7 +206,7 @@ typedef struct netdev2_driver { * @return number of bytes written to @p value * @return `< 0` on error, 0 on success */ - int (*get)(netdev2_t *dev, netopt_t opt, + int (*get)(netdev_t *dev, netopt_t opt, void *value, size_t max_len); /** @@ -222,12 +222,12 @@ typedef struct netdev2_driver { * @return number of bytes used from @p value * @return `< 0` on error, 0 on success */ - int (*set)(netdev2_t *dev, netopt_t opt, + int (*set)(netdev_t *dev, netopt_t opt, void *value, size_t value_len); -} netdev2_driver_t; +} netdev_driver_t; #ifdef __cplusplus } #endif /** @} */ -#endif /* NETDEV2_H */ +#endif /* NETDEV_H */ diff --git a/drivers/include/net/netdev2/eth.h b/drivers/include/net/netdev/eth.h similarity index 66% rename from drivers/include/net/netdev2/eth.h rename to drivers/include/net/netdev/eth.h index 9a8bf99186..6eef3430c5 100644 --- a/drivers/include/net/netdev2/eth.h +++ b/drivers/include/net/netdev/eth.h @@ -7,21 +7,21 @@ */ /** - * @ingroup drivers_netdev_netdev2 + * @ingroup drivers_netdev_api * @{ * * @file - * @brief Definitions for netdev2 common ethernet code + * @brief Definitions for netdev common ethernet code * * @author Kaspar Schleiser */ -#ifndef NETDEV2_ETH_H -#define NETDEV2_ETH_H +#ifndef NETDEV_ETH_H +#define NETDEV_ETH_H #include -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/netopt.h" #ifdef __cplusplus @@ -29,9 +29,9 @@ extern "C" { #endif /** - * @brief Fallback function for netdev2 ethernet devices' _get function + * @brief Fallback function for netdev ethernet devices' _get function * - * Supposed to be used by netdev2 drivers as default case. + * Supposed to be used by netdev drivers as default case. * * @warning Driver *MUST* implement NETOPT_ADDRESS case! * @@ -43,10 +43,10 @@ extern "C" { * @return number of bytes written to @p value * @return <0 on error */ -int netdev2_eth_get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len); +int netdev_eth_get(netdev_t *dev, netopt_t opt, void *value, size_t max_len); /** - * @brief Fallback function for netdev2 ethernet devices' _set function + * @brief Fallback function for netdev ethernet devices' _set function * * @param[in] dev network device descriptor * @param[in] opt option type @@ -56,10 +56,10 @@ int netdev2_eth_get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len); * @return number of bytes used from @p value * @return <0 on error */ -int netdev2_eth_set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len); +int netdev_eth_set(netdev_t *dev, netopt_t opt, void *value, size_t value_len); #ifdef __cplusplus } #endif /** @} */ -#endif /* NETDEV2_ETH_H */ +#endif /* NETDEV_ETH_H */ diff --git a/drivers/include/net/netdev2/ieee802154.h b/drivers/include/net/netdev/ieee802154.h similarity index 58% rename from drivers/include/net/netdev2/ieee802154.h rename to drivers/include/net/netdev/ieee802154.h index 96bfc0ccca..b66e5dbad8 100644 --- a/drivers/include/net/netdev2/ieee802154.h +++ b/drivers/include/net/netdev/ieee802154.h @@ -7,29 +7,29 @@ */ /** - * @ingroup drivers_netdev_netdev2 + * @ingroup drivers_netdev_api * @brief * @{ * * @file - * @brief Definitions for netdev2 common IEEE 802.15.4 code + * @brief Definitions for netdev common IEEE 802.15.4 code * * @author Martine Lenders */ -#ifndef NETDEV2_IEEE802154_H -#define NETDEV2_IEEE802154_H +#ifndef NETDEV_IEEE802154_H +#define NETDEV_IEEE802154_H #include "net/ieee802154.h" #include "net/gnrc/nettype.h" #include "net/netopt.h" -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { #endif /** - * @name IEEE 802.15.4 netdev2 flags + * @name IEEE 802.15.4 netdev flags * @brief Flags for netdev_ieee802154_t::flags * * The flag-space `0xff00` is available for device-specific flags. @@ -38,21 +38,21 @@ extern "C" { * @{ */ -#define NETDEV2_IEEE802154_SEND_MASK (0x0028) /**< flags to take for send packets */ -#define NETDEV2_IEEE802154_RAW (0x0002) /**< pass raw frame to upper layer */ +#define NETDEV_IEEE802154_SEND_MASK (0x0028) /**< flags to take for send packets */ +#define NETDEV_IEEE802154_RAW (0x0002) /**< pass raw frame to upper layer */ /** * @brief use long source addres (set) or short source address (unset) */ -#define NETDEV2_IEEE802154_SRC_MODE_LONG (0x0004) +#define NETDEV_IEEE802154_SRC_MODE_LONG (0x0004) /** * @brief enable security */ -#define NETDEV2_IEEE802154_SECURITY_EN (IEEE802154_FCF_SECURITY_EN) +#define NETDEV_IEEE802154_SECURITY_EN (IEEE802154_FCF_SECURITY_EN) /** * @brief request ACK from receiver */ -#define NETDEV2_IEEE802154_ACK_REQ (IEEE802154_FCF_ACK_REQ) +#define NETDEV_IEEE802154_ACK_REQ (IEEE802154_FCF_ACK_REQ) /** * @} */ @@ -63,25 +63,25 @@ extern "C" { * in Std 802.15.4. */ typedef enum { - NETDEV2_IEEE802154_CCA_MODE_1 = 1, /**< Energy above threshold */ - NETDEV2_IEEE802154_CCA_MODE_2, /**< Carrier sense only */ - NETDEV2_IEEE802154_CCA_MODE_3, /**< Carrier sense with energy above threshold */ - NETDEV2_IEEE802154_CCA_MODE_4, /**< ALOHA */ - NETDEV2_IEEE802154_CCA_MODE_5, /**< UWB preamble sense based on the SHR of a frame */ - NETDEV2_IEEE802154_CCA_MODE_6, /**< UWB preamble sense based on the packet + NETDEV_IEEE802154_CCA_MODE_1 = 1, /**< Energy above threshold */ + NETDEV_IEEE802154_CCA_MODE_2, /**< Carrier sense only */ + NETDEV_IEEE802154_CCA_MODE_3, /**< Carrier sense with energy above threshold */ + NETDEV_IEEE802154_CCA_MODE_4, /**< ALOHA */ + NETDEV_IEEE802154_CCA_MODE_5, /**< UWB preamble sense based on the SHR of a frame */ + NETDEV_IEEE802154_CCA_MODE_6, /**< UWB preamble sense based on the packet * with the multiplexed preamble */ -} netdev2_ieee802154_cca_mode_t; +} netdev_ieee802154_cca_mode_t; /** * @brief Extended structure to hold IEEE 802.15.4 driver state * - * @extends netdev2_t + * @extends netdev_t * * Supposed to be extended by driver implementations. * The extended structure should contain all variable driver state. */ typedef struct { - netdev2_t netdev; /**< @ref netdev2_t base class */ + netdev_t netdev; /**< @ref netdev_t base class */ /** * @brief IEEE 802.15.4 specific fields * @{ @@ -108,17 +108,17 @@ typedef struct { uint8_t chan; /**< channel */ uint16_t flags; /**< flags as defined above */ /** @} */ -} netdev2_ieee802154_t; +} netdev_ieee802154_t; /** * @brief Received packet status information for IEEE 802.15.4 radios */ -typedef struct netdev2_radio_rx_info netdev2_ieee802154_rx_info_t; +typedef struct netdev_radio_rx_info netdev_ieee802154_rx_info_t; /** - * @brief Fallback function for netdev2 IEEE 802.15.4 devices' _get function + * @brief Fallback function for netdev IEEE 802.15.4 devices' _get function * - * Supposed to be used by netdev2 drivers as default case. + * Supposed to be used by netdev drivers as default case. * * @param[in] dev network device descriptor * @param[in] opt option type @@ -128,24 +128,24 @@ typedef struct netdev2_radio_rx_info netdev2_ieee802154_rx_info_t; * @return number of bytes written to @p value * @return <0 on error */ -int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, - size_t max_len); +int netdev_ieee802154_get(netdev_ieee802154_t *dev, netopt_t opt, void *value, + size_t max_len); /** - * @brief Fallback function for netdev2 IEEE 802.15.4 devices' _set function + * @brief Fallback function for netdev IEEE 802.15.4 devices' _set function * - * Sets netdev2_ieee802154_t::pan, netdev2_ieee802154_t::short_addr, and - * netdev2_ieee802154_t::long_addr in device struct. - * Additionally @ref NETDEV2_IEEE802154_SRC_MODE_LONG, - * @ref NETDEV2_IEEE802154_RAW and, @ref NETDEV2_IEEE802154_ACK_REQ in - * netdev2_ieee802154_t::flags can be set or unset. + * Sets netdev_ieee802154_t::pan, netdev_ieee802154_t::short_addr, and + * netdev_ieee802154_t::long_addr in device struct. + * Additionally @ref NETDEV_IEEE802154_SRC_MODE_LONG, + * @ref NETDEV_IEEE802154_RAW and, @ref NETDEV_IEEE802154_ACK_REQ in + * netdev_ieee802154_t::flags can be set or unset. * - * The setting of netdev2_ieee802154_t::chan is omitted since the legality of + * The setting of netdev_ieee802154_t::chan is omitted since the legality of * its value can be very device specific and can't be checked in this function. - * Please set it in the netdev2_driver_t::set function of your driver. + * Please set it in the netdev_driver_t::set function of your driver. * - * Be aware that this only manipulates the netdev2_ieee802154_t struct. - * Configuration to the device needs to be done in the netdev2_driver_t::set + * Be aware that this only manipulates the netdev_ieee802154_t struct. + * Configuration to the device needs to be done in the netdev_driver_t::set * function of the device driver (which should call this function as a fallback * afterwards). * @@ -157,12 +157,12 @@ int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, * @return number of bytes used from @p value * @return <0 on error */ -int netdev2_ieee802154_set(netdev2_ieee802154_t *dev, netopt_t opt, void *value, - size_t value_len); +int netdev_ieee802154_set(netdev_ieee802154_t *dev, netopt_t opt, void *value, + size_t value_len); #ifdef __cplusplus } #endif -#endif /* NETDEV2_IEEE802154_H */ +#endif /* NETDEV_IEEE802154_H */ /** @} */ diff --git a/drivers/include/w5100.h b/drivers/include/w5100.h index b5b3a8d274..321d218e94 100644 --- a/drivers/include/w5100.h +++ b/drivers/include/w5100.h @@ -14,7 +14,7 @@ * This device driver only exposes the MACRAW mode of W5100 devices, so it does * not offer any support for the on-chip IPv4, UDP, and TCP capabilities of * these chips. In connection with RIOT we are only interested in the RAW - * Ethernet packets, which we can use through netdev2 with any software network + * Ethernet packets, which we can use through netdev with any software network * stack provided by RIOT (e.g. GNRC). This enables W5100 devices to communicate * via IPv6, enables unlimited connections, and more... * @@ -38,7 +38,7 @@ #include "periph/spi.h" #include "periph/gpio.h" -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -65,14 +65,14 @@ typedef struct { * @brief Device descriptor for W5100 devices */ typedef struct { - netdev2_t nd; /**< extends the netdev2 structure */ + netdev_t nd; /**< extends the netdev structure */ w5100_params_t p; /**< device configuration parameters */ } w5100_t; /** * @brief So the initial device setup * - * This function pre-initializes the netdev2 structure, saves the configuration + * This function pre-initializes the netdev structure, saves the configuration * parameters and finally initializes the SPI bus and the used GPIO pins. */ void w5100_setup(w5100_t *dev, const w5100_params_t *params); diff --git a/drivers/include/xbee.h b/drivers/include/xbee.h index 4a21f3920c..c4dcbcafe7 100644 --- a/drivers/include/xbee.h +++ b/drivers/include/xbee.h @@ -29,7 +29,7 @@ #include "xtimer.h" #include "periph/uart.h" #include "periph/gpio.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/ieee802154.h" #include "net/gnrc/nettype.h" @@ -130,8 +130,8 @@ typedef struct { */ typedef struct { /* netdev fields */ - const struct netdev2_driver *driver; /**< ptr to that driver's interface. */ - netdev2_event_cb_t event_callback; /**< callback for device events */ + const struct netdev_driver *driver; /**< ptr to that driver's interface. */ + netdev_event_cb_t event_callback; /**< callback for device events */ void* context; /**< ptr to network stack context */ #ifdef MODULE_NETSTATS_L2 netstats_t stats; /**< transceiver's statistics */ @@ -177,7 +177,7 @@ typedef struct { /** * @brief Reference to the XBee driver interface */ -extern const netdev2_driver_t xbee_driver; +extern const netdev_driver_t xbee_driver; /** * @brief Prepare the given Xbee device diff --git a/drivers/kw2xrf/include/kw2xrf_netdev.h b/drivers/kw2xrf/include/kw2xrf_netdev.h index 253c2440aa..f5dd4cdbb2 100644 --- a/drivers/kw2xrf/include/kw2xrf_netdev.h +++ b/drivers/kw2xrf/include/kw2xrf_netdev.h @@ -26,7 +26,7 @@ extern "C" { /** * @brief Reference to the netdev device driver struct */ -extern const netdev2_driver_t kw2xrf_driver; +extern const netdev_driver_t kw2xrf_driver; #ifdef __cplusplus } diff --git a/drivers/kw2xrf/kw2xrf.c b/drivers/kw2xrf/kw2xrf.c index b9bbfd20e3..9b3b91389f 100644 --- a/drivers/kw2xrf/kw2xrf.c +++ b/drivers/kw2xrf/kw2xrf.c @@ -56,7 +56,7 @@ static void kw2xrf_set_address(kw2xrf_t *dev) void kw2xrf_setup(kw2xrf_t *dev, const kw2xrf_params_t *params) { - netdev2_t *netdev = (netdev2_t *)dev; + netdev_t *netdev = (netdev_t *)dev; netdev->driver = &kw2xrf_driver; /* initialize device descriptor */ diff --git a/drivers/kw2xrf/kw2xrf_netdev.c b/drivers/kw2xrf/kw2xrf_netdev.c index a717eabb25..90c92b544a 100644 --- a/drivers/kw2xrf/kw2xrf_netdev.c +++ b/drivers/kw2xrf/kw2xrf_netdev.c @@ -23,8 +23,8 @@ #include "log.h" #include "net/eui64.h" #include "net/ieee802154.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #include "kw2xrf.h" #include "kw2xrf_spi.h" @@ -45,14 +45,14 @@ static uint8_t _send_last_fcf; static void _irq_handler(void *arg) { - netdev2_t *dev = (netdev2_t *) arg; + netdev_t *dev = (netdev_t *) arg; if (dev->event_callback) { - dev->event_callback(dev, NETDEV2_EVENT_ISR); + dev->event_callback(dev, NETDEV_EVENT_ISR); } } -static int _init(netdev2_t *netdev) +static int _init(netdev_t *netdev) { kw2xrf_t *dev = (kw2xrf_t *)netdev; @@ -91,7 +91,7 @@ static void kw2xrf_tx_exec(kw2xrf_t *dev) } } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { kw2xrf_t *dev = (kw2xrf_t *)netdev; const struct iovec *ptr = vector; @@ -141,7 +141,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) return (int)len; } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { kw2xrf_t *dev = (kw2xrf_t *)netdev; size_t pkt_len = 0; @@ -167,7 +167,7 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) kw2xrf_read_fifo(dev, (uint8_t *)buf, pkt_len + 1); if (info != NULL) { - netdev2_ieee802154_rx_info_t *radio_info = info; + netdev_ieee802154_rx_info_t *radio_info = info; radio_info->lqi = ((uint8_t*)buf)[pkt_len]; radio_info->rssi = (uint8_t)kw2xrf_get_rssi(radio_info->lqi); } @@ -208,7 +208,7 @@ static netopt_state_t _get_state(kw2xrf_t *dev) return dev->state; } -int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t len) +int _get(netdev_t *netdev, netopt_t opt, void *value, size_t len) { kw2xrf_t *dev = (kw2xrf_t *)netdev; @@ -307,9 +307,9 @@ int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t len) else { *(uint8_t *)value = kw2xrf_get_cca_mode(dev); switch (*((int8_t *)value)) { - case NETDEV2_IEEE802154_CCA_MODE_1: - case NETDEV2_IEEE802154_CCA_MODE_2: - case NETDEV2_IEEE802154_CCA_MODE_3: + case NETDEV_IEEE802154_CCA_MODE_1: + case NETDEV_IEEE802154_CCA_MODE_2: + case NETDEV_IEEE802154_CCA_MODE_3: return sizeof(uint8_t); default: break; @@ -323,10 +323,10 @@ int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t len) break; } - return netdev2_ieee802154_get((netdev2_ieee802154_t *)netdev, opt, value, len); + return netdev_ieee802154_get((netdev_ieee802154_t *)netdev, opt, value, len); } -static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t len) +static int _set(netdev_t *netdev, netopt_t opt, void *value, size_t len) { kw2xrf_t *dev = (kw2xrf_t *)netdev; int res = -ENOTSUP; @@ -342,7 +342,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t len) } else { kw2xrf_set_addr_short(dev, *((uint16_t *)value)); - /* don't set res to set netdev2_ieee802154_t::short_addr */ + /* don't set res to set netdev_ieee802154_t::short_addr */ } break; @@ -352,7 +352,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t len) } else { kw2xrf_set_addr_long(dev, *((uint64_t *)value)); - /* don't set res to set netdev2_ieee802154_t::short_addr */ + /* don't set res to set netdev_ieee802154_t::short_addr */ } break; @@ -363,7 +363,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t len) else { kw2xrf_set_pan(dev, *((uint16_t *)value)); - /* don't set res to set netdev2_ieee802154_t::pan */ + /* don't set res to set netdev_ieee802154_t::pan */ } break; @@ -378,7 +378,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t len) break; } dev->netdev.chan = chan; - /* don't set res to set netdev2_ieee802154_t::chan */ + /* don't set res to set netdev_ieee802154_t::chan */ } break; @@ -474,15 +474,15 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t len) } else { switch (*((int8_t*)value)) { - case NETDEV2_IEEE802154_CCA_MODE_1: - case NETDEV2_IEEE802154_CCA_MODE_2: - case NETDEV2_IEEE802154_CCA_MODE_3: + case NETDEV_IEEE802154_CCA_MODE_1: + case NETDEV_IEEE802154_CCA_MODE_2: + case NETDEV_IEEE802154_CCA_MODE_3: kw2xrf_set_cca_mode(dev, *((int8_t*)value)); res = sizeof(uint8_t); break; - case NETDEV2_IEEE802154_CCA_MODE_4: - case NETDEV2_IEEE802154_CCA_MODE_5: - case NETDEV2_IEEE802154_CCA_MODE_6: + case NETDEV_IEEE802154_CCA_MODE_4: + case NETDEV_IEEE802154_CCA_MODE_5: + case NETDEV_IEEE802154_CCA_MODE_6: default: break; } @@ -506,14 +506,14 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t len) } if (res == -ENOTSUP) { - res = netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, opt, + res = netdev_ieee802154_set((netdev_ieee802154_t *)netdev, opt, value, len); } return res; } -static void _isr_event_seq_r(netdev2_t *netdev, uint8_t *dregs) +static void _isr_event_seq_r(netdev_t *netdev, uint8_t *dregs) { kw2xrf_t *dev = (kw2xrf_t *)netdev; uint8_t irqsts1 = 0; @@ -521,14 +521,14 @@ static void _isr_event_seq_r(netdev2_t *netdev, uint8_t *dregs) if (dregs[MKW2XDM_IRQSTS1] & MKW2XDM_IRQSTS1_RXWTRMRKIRQ) { DEBUG("[kw2xrf] got RXWTRMRKIRQ\n"); irqsts1 |= MKW2XDM_IRQSTS1_RXWTRMRKIRQ; - netdev->event_callback(netdev, NETDEV2_EVENT_RX_STARTED); + netdev->event_callback(netdev, NETDEV_EVENT_RX_STARTED); } if (dregs[MKW2XDM_IRQSTS1] & MKW2XDM_IRQSTS1_RXIRQ) { DEBUG("[kw2xrf] finished RXSEQ\n"); dev->state = NETOPT_STATE_RX; irqsts1 |= MKW2XDM_IRQSTS1_RXIRQ; - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); if (dregs[MKW2XDM_PHY_CTRL1] & MKW2XDM_PHY_CTRL1_AUTOACK) { DEBUG("[kw2xrf]: perform TX ACK\n"); } @@ -549,7 +549,7 @@ static void _isr_event_seq_r(netdev2_t *netdev, uint8_t *dregs) dregs[MKW2XDM_IRQSTS1] &= ~irqsts1; } -static void _isr_event_seq_t(netdev2_t *netdev, uint8_t *dregs) +static void _isr_event_seq_t(netdev_t *netdev, uint8_t *dregs) { kw2xrf_t *dev = (kw2xrf_t *)netdev; uint8_t irqsts1 = 0; @@ -567,10 +567,10 @@ static void _isr_event_seq_t(netdev2_t *netdev, uint8_t *dregs) irqsts1 |= MKW2XDM_IRQSTS1_CCAIRQ; if (dregs[MKW2XDM_IRQSTS2] & MKW2XDM_IRQSTS2_CCA) { DEBUG("[kw2xrf] CCA CH busy\n"); - netdev->event_callback(netdev, NETDEV2_EVENT_TX_MEDIUM_BUSY); + netdev->event_callback(netdev, NETDEV_EVENT_TX_MEDIUM_BUSY); } else { - netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); } } @@ -584,7 +584,7 @@ static void _isr_event_seq_t(netdev2_t *netdev, uint8_t *dregs) } /* Standalone CCA */ -static void _isr_event_seq_cca(netdev2_t *netdev, uint8_t *dregs) +static void _isr_event_seq_cca(netdev_t *netdev, uint8_t *dregs) { kw2xrf_t *dev = (kw2xrf_t *)netdev; uint8_t irqsts1 = 0; @@ -604,7 +604,7 @@ static void _isr_event_seq_cca(netdev2_t *netdev, uint8_t *dregs) dregs[MKW2XDM_IRQSTS1] &= ~irqsts1; } -static void _isr_event_seq_tr(netdev2_t *netdev, uint8_t *dregs) +static void _isr_event_seq_tr(netdev_t *netdev, uint8_t *dregs) { kw2xrf_t *dev = (kw2xrf_t *)netdev; uint8_t irqsts1 = 0; @@ -638,7 +638,7 @@ static void _isr_event_seq_tr(netdev2_t *netdev, uint8_t *dregs) irqsts1 |= MKW2XDM_IRQSTS1_CCAIRQ; if (dregs[MKW2XDM_IRQSTS2] & MKW2XDM_IRQSTS2_CCA) { DEBUG("[kw2xrf] CCA CH busy\n"); - netdev->event_callback(netdev, NETDEV2_EVENT_TX_MEDIUM_BUSY); + netdev->event_callback(netdev, NETDEV_EVENT_TX_MEDIUM_BUSY); } } @@ -646,7 +646,7 @@ static void _isr_event_seq_tr(netdev2_t *netdev, uint8_t *dregs) irqsts1 |= MKW2XDM_IRQSTS1_SEQIRQ; assert(dev->pending_tx != 0); dev->pending_tx--; - netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); kw2xrf_seq_timeout_off(dev); kw2xrf_set_idle_sequence(dev); } @@ -654,7 +654,7 @@ static void _isr_event_seq_tr(netdev2_t *netdev, uint8_t *dregs) DEBUG("[kw2xrf] TC4TMOUT, no SEQIRQ, TX failed\n"); assert(dev->pending_tx != 0); dev->pending_tx--; - netdev->event_callback(netdev, NETDEV2_EVENT_TX_NOACK); + netdev->event_callback(netdev, NETDEV_EVENT_TX_NOACK); kw2xrf_seq_timeout_off(dev); kw2xrf_set_sequence(dev, dev->idle_state); } @@ -663,7 +663,7 @@ static void _isr_event_seq_tr(netdev2_t *netdev, uint8_t *dregs) dregs[MKW2XDM_IRQSTS1] &= ~irqsts1; } -static void _isr_event_seq_ccca(netdev2_t *netdev, uint8_t *dregs) +static void _isr_event_seq_ccca(netdev_t *netdev, uint8_t *dregs) { kw2xrf_t *dev = (kw2xrf_t *)netdev; uint8_t irqsts1 = 0; @@ -685,7 +685,7 @@ static void _isr_event_seq_ccca(netdev2_t *netdev, uint8_t *dregs) dregs[MKW2XDM_IRQSTS1] &= ~irqsts1; } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { uint8_t dregs[MKW2XDM_PHY_CTRL4 + 1]; kw2xrf_t *dev = (kw2xrf_t *)netdev; @@ -754,7 +754,7 @@ static void _isr(netdev2_t *netdev) kw2xrf_enable_irq_b(dev); } -const netdev2_driver_t kw2xrf_driver = { +const netdev_driver_t kw2xrf_driver = { .init = _init, .send = _send, .recv = _recv, diff --git a/drivers/mrf24j40/include/mrf24j40_netdev.h b/drivers/mrf24j40/include/mrf24j40_netdev.h index eb95d20cd2..0769604558 100644 --- a/drivers/mrf24j40/include/mrf24j40_netdev.h +++ b/drivers/mrf24j40/include/mrf24j40_netdev.h @@ -21,7 +21,7 @@ #ifndef MRF24J40_NETDEV_H #define MRF24J40_NETDEV_H -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -30,7 +30,7 @@ extern "C" { /** * @brief Reference to the netdev device driver struct */ -extern const netdev2_driver_t mrf24j40_driver; +extern const netdev_driver_t mrf24j40_driver; #ifdef __cplusplus diff --git a/drivers/mrf24j40/mrf24j40.c b/drivers/mrf24j40/mrf24j40.c index 302036c4aa..b3706f4ce5 100644 --- a/drivers/mrf24j40/mrf24j40.c +++ b/drivers/mrf24j40/mrf24j40.c @@ -33,7 +33,7 @@ void mrf24j40_setup(mrf24j40_t *dev, const mrf24j40_params_t *params) { - netdev2_t *netdev = (netdev2_t *)dev; + netdev_t *netdev = (netdev_t *)dev; netdev->driver = &mrf24j40_driver; /* initialize device descriptor */ @@ -67,8 +67,8 @@ void mrf24j40_reset(mrf24j40_t *dev) /* set default options */ mrf24j40_set_option(dev, IEEE802154_FCF_PAN_COMP, true); - mrf24j40_set_option(dev, NETDEV2_IEEE802154_SRC_MODE_LONG, true); - mrf24j40_set_option(dev, NETDEV2_IEEE802154_ACK_REQ, true); + mrf24j40_set_option(dev, NETDEV_IEEE802154_SRC_MODE_LONG, true); + mrf24j40_set_option(dev, NETDEV_IEEE802154_ACK_REQ, true); mrf24j40_set_option(dev, MRF24J40_OPT_CSMA, true); mrf24j40_set_option(dev, MRF24J40_OPT_TELL_RX_START, false); mrf24j40_set_option(dev, MRF24J40_OPT_TELL_RX_END, true); @@ -142,7 +142,7 @@ size_t mrf24j40_tx_load(mrf24j40_t *dev, uint8_t *data, size_t len, size_t offse void mrf24j40_tx_exec(mrf24j40_t *dev) { - netdev2_t *netdev = (netdev2_t *)dev; + netdev_t *netdev = (netdev_t *)dev; dev->tx_frame_len = dev->tx_frame_len - IEEE802154_FCS_LEN; @@ -156,13 +156,13 @@ void mrf24j40_tx_exec(mrf24j40_t *dev) */ mrf24j40_reg_write_long(dev, MRF24J40_TX_NORMAL_FIFO, dev->header_len); - if (dev->netdev.flags & NETDEV2_IEEE802154_ACK_REQ) { + if (dev->netdev.flags & NETDEV_IEEE802154_ACK_REQ) { mrf24j40_reg_write_short(dev, MRF24J40_REG_TXNCON, MRF24J40_TXNCON_TXNACKREQ | MRF24J40_TXNCON_TXNTRIG); } else { mrf24j40_reg_write_short(dev, MRF24J40_REG_TXNCON, MRF24J40_TXNCON_TXNTRIG); } if (netdev->event_callback && (dev->netdev.flags & MRF24J40_OPT_TELL_TX_START)) { - netdev->event_callback(netdev, NETDEV2_EVENT_TX_STARTED); + netdev->event_callback(netdev, NETDEV_EVENT_TX_STARTED); } } diff --git a/drivers/mrf24j40/mrf24j40_getset.c b/drivers/mrf24j40/mrf24j40_getset.c index 9da3b8fd67..1d996b993e 100644 --- a/drivers/mrf24j40/mrf24j40_getset.c +++ b/drivers/mrf24j40/mrf24j40_getset.c @@ -351,7 +351,7 @@ void mrf24j40_set_option(mrf24j40_t *dev, uint16_t option, bool state) tmp &= ~MRF24J40_RXMCR_ERRPKT; mrf24j40_reg_write_short(dev, MRF24J40_REG_RXMCR, tmp); break; - case NETDEV2_IEEE802154_ACK_REQ: + case NETDEV_IEEE802154_ACK_REQ: DEBUG("[mrf24j40] opt: enabling auto ACKs\n"); tmp = mrf24j40_reg_read_short(dev, MRF24J40_REG_RXMCR); tmp &= ~MRF24J40_RXMCR_NOACKRSP; @@ -383,12 +383,12 @@ void mrf24j40_set_option(mrf24j40_t *dev, uint16_t option, bool state) tmp &= ~MRF24J40_RXMCR_PROMI; tmp &= ~MRF24J40_RXMCR_ERRPKT; /* re-enable AUTOACK only if the option is set */ - if (dev->netdev.flags & NETDEV2_IEEE802154_ACK_REQ) { + if (dev->netdev.flags & NETDEV_IEEE802154_ACK_REQ) { tmp &= ~(MRF24J40_RXMCR_NOACKRSP); mrf24j40_reg_write_short(dev, MRF24J40_REG_RXMCR, tmp); } break; - case NETDEV2_IEEE802154_ACK_REQ: + case NETDEV_IEEE802154_ACK_REQ: DEBUG("[mrf24j40] opt: disabling auto ACKs\n"); tmp = mrf24j40_reg_read_short(dev, MRF24J40_REG_RXMCR); tmp |= MRF24J40_RXMCR_NOACKRSP; diff --git a/drivers/mrf24j40/mrf24j40_netdev.c b/drivers/mrf24j40/mrf24j40_netdev.c index 7573950cc6..9ace88c438 100644 --- a/drivers/mrf24j40/mrf24j40_netdev.c +++ b/drivers/mrf24j40/mrf24j40_netdev.c @@ -26,8 +26,8 @@ #include "net/eui64.h" #include "net/ieee802154.h" -#include "net/netdev2.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev.h" +#include "net/netdev/ieee802154.h" #include "mrf24j40.h" #include "mrf24j40_netdev.h" @@ -39,14 +39,14 @@ #define _MAX_MHR_OVERHEAD (25) -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count); -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info); -static int _init(netdev2_t *netdev); -static void _isr(netdev2_t *netdev); -static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len); -static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len); +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count); +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); +static int _init(netdev_t *netdev); +static void _isr(netdev_t *netdev); +static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len); +static int _set(netdev_t *netdev, netopt_t opt, void *val, size_t len); -const netdev2_driver_t mrf24j40_driver = { +const netdev_driver_t mrf24j40_driver = { .send = _send, .recv = _recv, .init = _init, @@ -57,15 +57,15 @@ const netdev2_driver_t mrf24j40_driver = { static void _irq_handler(void *arg) { - netdev2_t *dev = (netdev2_t *) arg; + netdev_t *dev = (netdev_t *) arg; if (dev->event_callback) { - dev->event_callback(dev, NETDEV2_EVENT_ISR); + dev->event_callback(dev, NETDEV_EVENT_ISR); } ((mrf24j40_t *)arg)->irq_flag = 1; } -static int _init(netdev2_t *netdev) +static int _init(netdev_t *netdev) { mrf24j40_t *dev = (mrf24j40_t *)netdev; @@ -83,7 +83,7 @@ static int _init(netdev2_t *netdev) return 0; } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { mrf24j40_t *dev = (mrf24j40_t *)netdev; const struct iovec *ptr = vector; @@ -119,7 +119,7 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { mrf24j40_t *dev = (mrf24j40_t *)netdev; uint8_t phr; @@ -153,7 +153,7 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) mrf24j40_rx_fifo_read(dev, 1, (uint8_t *)buf, pkt_len); if (info != NULL) { - netdev2_ieee802154_rx_info_t *radio_info = info; + netdev_ieee802154_rx_info_t *radio_info = info; /* Read LQI and RSSI values from the RX fifo */ mrf24j40_rx_fifo_read(dev, phr + 1, &(radio_info->lqi), 1); mrf24j40_rx_fifo_read(dev, phr + 2, &(radio_info->rssi), 1); @@ -179,7 +179,7 @@ static netopt_state_t _get_state(mrf24j40_t *dev) return NETOPT_STATE_IDLE; } -static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) +static int _get(netdev_t *netdev, netopt_t opt, void *val, size_t max_len) { mrf24j40_t *dev = (mrf24j40_t *) netdev; @@ -321,8 +321,8 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *val, size_t max_len) break; default: - /* try netdev2 settings */ - res = netdev2_ieee802154_get((netdev2_ieee802154_t *)netdev, opt, + /* try netdev settings */ + res = netdev_ieee802154_get((netdev_ieee802154_t *)netdev, opt, val, max_len); } return res; @@ -351,7 +351,7 @@ static int _set_state(mrf24j40_t *dev, netopt_state_t state) return sizeof(netopt_state_t); } -static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) +static int _set(netdev_t *netdev, netopt_t opt, void *val, size_t len) { mrf24j40_t *dev = (mrf24j40_t *) netdev; int res = -ENOTSUP; @@ -367,7 +367,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) } else { mrf24j40_set_addr_short(dev, *((uint16_t *)val)); - /* don't set res to set netdev2_ieee802154_t::short_addr */ + /* don't set res to set netdev_ieee802154_t::short_addr */ } break; @@ -377,7 +377,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) } else { mrf24j40_set_addr_long(dev, *((uint64_t *)val)); - /* don't set res to set netdev2_ieee802154_t::long_addr */ + /* don't set res to set netdev_ieee802154_t::long_addr */ } break; @@ -387,7 +387,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) } else { mrf24j40_set_pan(dev, *((uint16_t *)val)); - /* don't set res to set netdev2_ieee802154_t::pan */ + /* don't set res to set netdev_ieee802154_t::pan */ } break; @@ -404,7 +404,7 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) break; } mrf24j40_set_chan(dev, chan); - /* don't set res to set netdev2_ieee802154_t::chan */ + /* don't set res to set netdev_ieee802154_t::chan */ } break; @@ -445,9 +445,9 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) break; case NETOPT_AUTOACK: - mrf24j40_set_option(dev, NETDEV2_IEEE802154_ACK_REQ, + mrf24j40_set_option(dev, NETDEV_IEEE802154_ACK_REQ, ((bool *)val)[0]); - /* don't set res to set netdev2_ieee802154_t::flags */ + /* don't set res to set netdev_ieee802154_t::flags */ break; case NETOPT_PRELOADING: @@ -517,15 +517,15 @@ static int _set(netdev2_t *netdev, netopt_t opt, void *val, size_t len) default: break; } - /* try netdev2 building flags */ + /* try netdev building flags */ if (res == -ENOTSUP) { - res = netdev2_ieee802154_set((netdev2_ieee802154_t *)netdev, opt, + res = netdev_ieee802154_set((netdev_ieee802154_t *)netdev, opt, val, len); } return res; } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { mrf24j40_t *dev = (mrf24j40_t *) netdev; /* update pending bits */ @@ -542,17 +542,17 @@ static void _isr(netdev2_t *netdev) if (txstat & MRF24J40_TXSTAT_TXNSTAT) { /* TX_NOACK - CCAFAIL */ if (txstat & MRF24J40_TXSTAT_CCAFAIL) { - netdev->event_callback(netdev, NETDEV2_EVENT_TX_MEDIUM_BUSY); + netdev->event_callback(netdev, NETDEV_EVENT_TX_MEDIUM_BUSY); DEBUG("[mrf24j40] TX_CHANNEL_ACCESS_FAILURE\n"); } /* check max retries */ else if (txstat & MRF24J40_TXSTAT_MAX_FRAME_RETRIES) { - netdev->event_callback(netdev, NETDEV2_EVENT_TX_NOACK); + netdev->event_callback(netdev, NETDEV_EVENT_TX_NOACK); DEBUG("[mrf24j40] TX NO_ACK\n"); } } else { - netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); } } #endif @@ -561,7 +561,7 @@ static void _isr(netdev2_t *netdev) if (dev->pending & MRF24J40_TASK_RX_READY) { DEBUG("[mrf24j40] EVT - RX_END\n"); if ((dev->netdev.flags & MRF24J40_OPT_TELL_RX_END)) { - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } dev->pending &= ~(MRF24J40_TASK_RX_READY); } diff --git a/drivers/netdev2_eth/Makefile b/drivers/netdev_eth/Makefile similarity index 100% rename from drivers/netdev2_eth/Makefile rename to drivers/netdev_eth/Makefile diff --git a/drivers/netdev2_eth/netdev2_eth.c b/drivers/netdev_eth/netdev_eth.c similarity index 84% rename from drivers/netdev2_eth/netdev2_eth.c rename to drivers/netdev_eth/netdev_eth.c index 6e7b641f2c..b0c6d0da81 100644 --- a/drivers/netdev2_eth/netdev2_eth.c +++ b/drivers/netdev_eth/netdev_eth.c @@ -7,11 +7,11 @@ */ /** - * @ingroup driver_netdev2_eth + * @ingroup driver_netdev_eth * @{ * * @file - * @brief Common code for netdev2 ethernet drivers + * @brief Common code for netdev ethernet drivers * * @author Kaspar Schleiser * @@ -21,14 +21,14 @@ #include #include -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/eui64.h" #include "net/ethernet.h" #define ENABLE_DEBUG (0) #include "debug.h" -static int _get_iid(netdev2_t *netdev, eui64_t *value, size_t max_len) +static int _get_iid(netdev_t *netdev, eui64_t *value, size_t max_len) { if (max_len < sizeof(eui64_t)) { return -EOVERFLOW; @@ -41,7 +41,7 @@ static int _get_iid(netdev2_t *netdev, eui64_t *value, size_t max_len) return sizeof(eui64_t); } -int netdev2_eth_get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) +int netdev_eth_get(netdev_t *dev, netopt_t opt, void *value, size_t max_len) { int res = 0; @@ -49,7 +49,7 @@ int netdev2_eth_get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) case NETOPT_DEVICE_TYPE: { uint16_t *tgt = (uint16_t *)value; - *tgt = NETDEV2_TYPE_ETHERNET; + *tgt = NETDEV_TYPE_ETHERNET; res = 2; break; } @@ -98,7 +98,7 @@ int netdev2_eth_get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len) return res; } -int netdev2_eth_set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len) +int netdev_eth_set(netdev_t *dev, netopt_t opt, void *value, size_t value_len) { (void)dev; (void)value; diff --git a/drivers/netdev2_ieee802154/Makefile b/drivers/netdev_ieee802154/Makefile similarity index 100% rename from drivers/netdev2_ieee802154/Makefile rename to drivers/netdev_ieee802154/Makefile diff --git a/drivers/netdev2_ieee802154/netdev2_ieee802154.c b/drivers/netdev_ieee802154/netdev_ieee802154.c similarity index 85% rename from drivers/netdev2_ieee802154/netdev2_ieee802154.c rename to drivers/netdev_ieee802154/netdev_ieee802154.c index 26ec0a14e3..708c6480ff 100644 --- a/drivers/netdev2_ieee802154/netdev2_ieee802154.c +++ b/drivers/netdev_ieee802154/netdev_ieee802154.c @@ -20,21 +20,21 @@ #include "net/eui64.h" #include "net/ieee802154.h" -#include "net/netdev2.h" +#include "net/netdev.h" -#include "net/netdev2/ieee802154.h" +#include "net/netdev/ieee802154.h" #define ENABLE_DEBUG (0) #include "debug.h" -static int _get_iid(netdev2_ieee802154_t *dev, eui64_t *value, size_t max_len) +static int _get_iid(netdev_ieee802154_t *dev, eui64_t *value, size_t max_len) { uint8_t *addr; uint16_t addr_len; assert(max_len >= sizeof(eui64_t)); - if (dev->flags & NETDEV2_IEEE802154_SRC_MODE_LONG) { + if (dev->flags & NETDEV_IEEE802154_SRC_MODE_LONG) { addr_len = IEEE802154_LONG_ADDRESS_LEN; addr = dev->long_addr; } @@ -47,7 +47,7 @@ static int _get_iid(netdev2_ieee802154_t *dev, eui64_t *value, size_t max_len) return sizeof(eui64_t); } -int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, +int netdev_ieee802154_get(netdev_ieee802154_t *dev, netopt_t opt, void *value, size_t max_len) { int res = -ENOTSUP; @@ -66,7 +66,7 @@ int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, case NETOPT_ADDR_LEN: case NETOPT_SRC_LEN: assert(max_len == sizeof(uint16_t)); - if (dev->flags & NETDEV2_IEEE802154_SRC_MODE_LONG) { + if (dev->flags & NETDEV_IEEE802154_SRC_MODE_LONG) { *((uint16_t *)value) = IEEE802154_LONG_ADDRESS_LEN; } else { @@ -86,7 +86,7 @@ int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, break; case NETOPT_ACK_REQ: assert(max_len == sizeof(netopt_enable_t)); - if (dev->flags & NETDEV2_IEEE802154_ACK_REQ) { + if (dev->flags & NETDEV_IEEE802154_ACK_REQ) { *((netopt_enable_t *)value) = NETOPT_ENABLE; } else { @@ -96,7 +96,7 @@ int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, break; case NETOPT_RAWMODE: assert(max_len == sizeof(netopt_enable_t)); - if (dev->flags & NETDEV2_IEEE802154_RAW) { + if (dev->flags & NETDEV_IEEE802154_RAW) { *((netopt_enable_t *)value) = NETOPT_ENABLE; } else { @@ -113,7 +113,7 @@ int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, #endif case NETOPT_DEVICE_TYPE: assert(max_len == sizeof(uint16_t)); - *((uint16_t *)value) = NETDEV2_TYPE_IEEE802154; + *((uint16_t *)value) = NETDEV_TYPE_IEEE802154; res = sizeof(uint16_t); break; case NETOPT_IPV6_IID: @@ -132,7 +132,7 @@ int netdev2_ieee802154_get(netdev2_ieee802154_t *dev, netopt_t opt, void *value, return res; } -int netdev2_ieee802154_set(netdev2_ieee802154_t *dev, netopt_t opt, void *value, +int netdev_ieee802154_set(netdev_ieee802154_t *dev, netopt_t opt, void *value, size_t len) { int res = -ENOTSUP; @@ -167,10 +167,10 @@ int netdev2_ieee802154_set(netdev2_ieee802154_t *dev, netopt_t opt, void *value, assert(len == sizeof(uint16_t)); switch ((*(uint16_t *)value)) { case IEEE802154_SHORT_ADDRESS_LEN: - dev->flags &= ~NETDEV2_IEEE802154_SRC_MODE_LONG; + dev->flags &= ~NETDEV_IEEE802154_SRC_MODE_LONG; break; case IEEE802154_LONG_ADDRESS_LEN: - dev->flags |= NETDEV2_IEEE802154_SRC_MODE_LONG; + dev->flags |= NETDEV_IEEE802154_SRC_MODE_LONG; break; default: res = -EAFNOSUPPORT; @@ -185,19 +185,19 @@ int netdev2_ieee802154_set(netdev2_ieee802154_t *dev, netopt_t opt, void *value, break; case NETOPT_ACK_REQ: if ((*(bool *)value)) { - dev->flags |= NETDEV2_IEEE802154_ACK_REQ; + dev->flags |= NETDEV_IEEE802154_ACK_REQ; } else { - dev->flags &= ~NETDEV2_IEEE802154_ACK_REQ; + dev->flags &= ~NETDEV_IEEE802154_ACK_REQ; } res = sizeof(uint16_t); break; case NETOPT_RAWMODE: if ((*(bool *)value)) { - dev->flags |= NETDEV2_IEEE802154_RAW; + dev->flags |= NETDEV_IEEE802154_RAW; } else { - dev->flags &= ~NETDEV2_IEEE802154_RAW; + dev->flags &= ~NETDEV_IEEE802154_RAW; } res = sizeof(uint16_t); break; diff --git a/drivers/w5100/w5100.c b/drivers/w5100/w5100.c index 00dc89a35a..33e2f0f03e 100644 --- a/drivers/w5100/w5100.c +++ b/drivers/w5100/w5100.c @@ -26,7 +26,7 @@ #include "assert.h" #include "net/ethernet.h" -#include "net/netdev2/eth.h" +#include "net/netdev/eth.h" #include "w5100.h" #include "w5100_regs.h" @@ -43,7 +43,7 @@ #define S0_TX_BASE (0x4000) #define S0_RX_BASE (0x6000) -static const netdev2_driver_t netdev2_driver_w5100; +static const netdev_driver_t netdev_driver_w5100; static inline void send_addr(w5100_t *dev, uint16_t addr) { @@ -107,14 +107,14 @@ static void extint(void *arg) w5100_t *dev = (w5100_t *)arg; if (dev->nd.event_callback) { - dev->nd.event_callback(&dev->nd, NETDEV2_EVENT_ISR); + dev->nd.event_callback(&dev->nd, NETDEV_EVENT_ISR); } } void w5100_setup(w5100_t *dev, const w5100_params_t *params) { /* initialize netdev structure */ - dev->nd.driver = &netdev2_driver_w5100; + dev->nd.driver = &netdev_driver_w5100; dev->nd.event_callback = NULL; dev->nd.context = dev; @@ -126,7 +126,7 @@ void w5100_setup(w5100_t *dev, const w5100_params_t *params) gpio_init_int(dev->p.evt, GPIO_IN, GPIO_FALLING, extint, dev); } -static int init(netdev2_t *netdev) +static int init(netdev_t *netdev) { w5100_t *dev = (w5100_t *)netdev; uint8_t tmp; @@ -194,7 +194,7 @@ static uint16_t tx_upload(w5100_t *dev, uint16_t start, void *data, size_t len) } } -static int send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int send(netdev_t *netdev, const struct iovec *vector, unsigned count) { w5100_t *dev = (w5100_t *)netdev; int sum = 0; @@ -230,7 +230,7 @@ static int send(netdev2_t *netdev, const struct iovec *vector, unsigned count) return sum; } -static int recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int recv(netdev_t *netdev, void *buf, size_t len, void *info) { (void)info; w5100_t *dev = (w5100_t *)netdev; @@ -279,7 +279,7 @@ static int recv(netdev2_t *netdev, void *buf, size_t len, void *info) return n; } -static void isr(netdev2_t *netdev) +static void isr(netdev_t *netdev) { uint8_t ir; w5100_t *dev = (w5100_t *)netdev; @@ -290,12 +290,12 @@ static void isr(netdev2_t *netdev) ir = rreg(dev, S0_IR); spi_release(dev->p.spi); while (ir & IR_RECV) { - DEBUG("[w5100] netdev2 RX complete\n"); - netdev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + DEBUG("[w5100] netdev RX complete\n"); + netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } } -static int get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) +static int get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len) { w5100_t *dev = (w5100_t *)netdev; int res = 0; @@ -309,18 +309,18 @@ static int get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) res = ETHERNET_ADDR_LEN; break; default: - res = netdev2_eth_get(netdev, opt, value, max_len); + res = netdev_eth_get(netdev, opt, value, max_len); break; } return res; } -static const netdev2_driver_t netdev2_driver_w5100 = { +static const netdev_driver_t netdev_driver_w5100 = { .send = send, .recv = recv, .init = init, .isr = isr, .get = get, - .set = netdev2_eth_set, + .set = netdev_eth_set, }; diff --git a/drivers/xbee/xbee.c b/drivers/xbee/xbee.c index 58596ff5dd..78c6dfb63b 100644 --- a/drivers/xbee/xbee.c +++ b/drivers/xbee/xbee.c @@ -27,7 +27,7 @@ #include "assert.h" #include "xtimer.h" #include "net/eui64.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/ieee802154.h" #define ENABLE_DEBUG (0) @@ -231,7 +231,7 @@ static void _rx_cb(void *arg, uint8_t c) if (dev->rx_count == dev->rx_limit) { /* packet is complete */ if (dev->event_callback) { - dev->event_callback((netdev2_t *)dev, NETDEV2_EVENT_ISR); + dev->event_callback((netdev_t *)dev, NETDEV_EVENT_ISR); } dev->int_state = XBEE_INT_STATE_IDLE; } @@ -566,7 +566,7 @@ int xbee_parse_hdr(xbee_t *dev, const uint8_t *xhdr, xbee_l2hdr_t *l2hdr) return (int)(alen + 3); } -int xbee_init(netdev2_t *dev) +int xbee_init(netdev_t *dev) { uint8_t tmp[2]; xbee_t *xbee = (xbee_t *)dev; @@ -631,7 +631,7 @@ int xbee_init(netdev2_t *dev) return 0; } -static int xbee_send(netdev2_t *dev, const struct iovec *vector, unsigned count) +static int xbee_send(netdev_t *dev, const struct iovec *vector, unsigned count) { xbee_t *xbee = (xbee_t *)dev; size_t size; @@ -668,7 +668,7 @@ static int xbee_send(netdev2_t *dev, const struct iovec *vector, unsigned count) return (int)size; } -static int xbee_recv(netdev2_t *dev, void *buf, size_t len, void *info) +static int xbee_recv(netdev_t *dev, void *buf, size_t len, void *info) { (void)info; size_t size; @@ -703,7 +703,7 @@ static int xbee_recv(netdev2_t *dev, void *buf, size_t len, void *info) return (int)size; } -static void xbee_isr(netdev2_t *netdev) +static void xbee_isr(netdev_t *netdev) { xbee_t *dev = (xbee_t *)netdev; @@ -715,12 +715,12 @@ static void xbee_isr(netdev2_t *netdev) } else { DEBUG("[xbee] isr: data available, waiting for read\n"); - dev->event_callback(netdev, NETDEV2_EVENT_RX_COMPLETE); + dev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE); } } } -static int xbee_get(netdev2_t *ndev, netopt_t opt, void *value, size_t max_len) +static int xbee_get(netdev_t *ndev, netopt_t opt, void *value, size_t max_len) { xbee_t *dev = (xbee_t *)ndev; assert(dev); @@ -774,7 +774,7 @@ static int xbee_get(netdev2_t *ndev, netopt_t opt, void *value, size_t max_len) } } -static int xbee_set(netdev2_t *ndev, netopt_t opt, void *value, size_t len) +static int xbee_set(netdev_t *ndev, netopt_t opt, void *value, size_t len) { xbee_t *dev = (xbee_t *)ndev; assert(dev); @@ -803,7 +803,7 @@ static int xbee_set(netdev2_t *ndev, netopt_t opt, void *value, size_t len) /* * The drivers netdev interface */ -const netdev2_driver_t xbee_driver = { +const netdev_driver_t xbee_driver = { .send = xbee_send, .recv = xbee_recv, .init = xbee_init, diff --git a/examples/gnrc_border_router/Makefile b/examples/gnrc_border_router/Makefile index 93a37a0ebb..cde3e5c56c 100644 --- a/examples/gnrc_border_router/Makefile +++ b/examples/gnrc_border_router/Makefile @@ -21,7 +21,7 @@ BOARD_BLACKLIST += mips-malta # No UART available. # UART, but not on native, as native has a tap interface towards the host. ifeq (,$(filter native,$(BOARD))) GNRC_NETIF_NUMOF := 2 -USEMODULE += ethos gnrc_netdev2 +USEMODULE += ethos gnrc_netdev # ethos baudrate can be configured from make command ETHOS_BAUDRATE ?= 115200 diff --git a/examples/gnrc_border_router/README.md b/examples/gnrc_border_router/README.md index fbfb26eff9..085deefd17 100644 --- a/examples/gnrc_border_router/README.md +++ b/examples/gnrc_border_router/README.md @@ -101,7 +101,7 @@ has the following: ```make ifeq (,$(filter native,$(BOARD))) GNRC_NETIF_NUMOF := 2 -USEMODULE += ethos gnrc_netdev2 +USEMODULE += ethos gnrc_netdev CFLAGS += '-DETHOS_UART=UART_DEV(0)' -DETHOS_BAUDRATE=115200 -DUSE_ETHOS_FOR_STDIO FEATURES_REQUIRED += periph_uart endif diff --git a/pkg/emb6/Makefile.dep b/pkg/emb6/Makefile.dep index e137de0dbb..652cc1063f 100644 --- a/pkg/emb6/Makefile.dep +++ b/pkg/emb6/Makefile.dep @@ -15,7 +15,7 @@ ifneq (,$(filter emb6,$(USEMODULE))) USEMODULE += emb6_ipv6_multicast USEMODULE += emb6_llsec USEMODULE += emb6_mac - USEMODULE += emb6_netdev2 + USEMODULE += emb6_netdev USEMODULE += emb6_rpl USEMODULE += emb6_sicslowpan USEMODULE += emb6_utils diff --git a/pkg/emb6/Makefile.include b/pkg/emb6/Makefile.include index 2b10bec81e..5b15adedeb 100644 --- a/pkg/emb6/Makefile.include +++ b/pkg/emb6/Makefile.include @@ -46,8 +46,8 @@ ifneq (,$(filter emb6_mac,$(USEMODULE))) INCLUDES += -I$(EMB6_DIR)/emb6/inc/mac endif -ifneq (,$(filter emb6_netdev2,$(USEMODULE))) - DIRS += $(EMB6_CONTRIB)/netdev2 +ifneq (,$(filter emb6_netdev,$(USEMODULE))) + DIRS += $(EMB6_CONTRIB)/netdev endif ifneq (,$(filter emb6_rpl,$(USEMODULE))) diff --git a/pkg/emb6/contrib/board_conf.c b/pkg/emb6/contrib/board_conf.c index 1ba6463a68..d63ba134f1 100644 --- a/pkg/emb6/contrib/board_conf.c +++ b/pkg/emb6/contrib/board_conf.c @@ -13,7 +13,7 @@ * @author Martine Lenders */ -#include "emb6/netdev2.h" +#include "emb6/netdev.h" #include "etimer.h" #include "board_conf.h" @@ -24,7 +24,7 @@ uint8_t board_conf(s_ns_t *ps_nStack) { if (ps_nStack != NULL) { - ps_nStack->inif = &emb6_netdev2_driver; + ps_nStack->inif = &emb6_netdev_driver; etimer_init(); return ps_nStack->inif->init(ps_nStack); } diff --git a/pkg/emb6/contrib/netdev2/Makefile b/pkg/emb6/contrib/netdev/Makefile similarity index 61% rename from pkg/emb6/contrib/netdev2/Makefile rename to pkg/emb6/contrib/netdev/Makefile index bdc2e75de0..e8dd709650 100644 --- a/pkg/emb6/contrib/netdev2/Makefile +++ b/pkg/emb6/contrib/netdev/Makefile @@ -1,3 +1,3 @@ -MODULE = emb6_netdev2 +MODULE = emb6_netdev include $(RIOTBASE)/Makefile.base diff --git a/pkg/emb6/contrib/netdev2/emb6_netdev2.c b/pkg/emb6/contrib/netdev/emb6_netdev.c similarity index 61% rename from pkg/emb6/contrib/netdev2/emb6_netdev2.c rename to pkg/emb6/contrib/netdev/emb6_netdev.c index e2905c292c..217a2b6203 100644 --- a/pkg/emb6/contrib/netdev2/emb6_netdev2.c +++ b/pkg/emb6/contrib/netdev/emb6_netdev.c @@ -18,7 +18,7 @@ #include #include "msg.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "evproc.h" #include "emb6.h" @@ -30,42 +30,42 @@ extern uip_lladdr_t uip_lladdr; -static netdev2_t *_dev = NULL; +static netdev_t *_dev = NULL; static s_nsLowMac_t *_lowmac = NULL; static int8_t _rssi_base_value = -100; static uint8_t _last_rssi; -static int8_t _netdev2_init(s_ns_t *p_ns); -static int8_t _netdev2_send(const void *pr_payload, uint8_t c_len); -static int8_t _netdev2_on(void); -static int8_t _netdev2_off(void); -static void _netdev2_set_txpower(int8_t power); -static int8_t _netdev2_get_txpower(void); -static void _netdev2_set_sensitivity(int8_t sens); -static int8_t _netdev2_get_sensitivity(void); -static int8_t _netdev2_get_rssi(void); -static void _netdev2_set_promisc(uint8_t c_on_off); +static int8_t _netdev_init(s_ns_t *p_ns); +static int8_t _netdev_send(const void *pr_payload, uint8_t c_len); +static int8_t _netdev_on(void); +static int8_t _netdev_off(void); +static void _netdev_set_txpower(int8_t power); +static int8_t _netdev_get_txpower(void); +static void _netdev_set_sensitivity(int8_t sens); +static int8_t _netdev_get_sensitivity(void); +static int8_t _netdev_get_rssi(void); +static void _netdev_set_promisc(uint8_t c_on_off); -const s_nsIf_t emb6_netdev2_driver = { - .name = "netdev2", - .init = &_netdev2_init, - .send = &_netdev2_send, - .on = &_netdev2_on, - .off = &_netdev2_off, - .set_txpower = &_netdev2_set_txpower, - .get_txpower = &_netdev2_get_txpower, - .set_sensitivity = &_netdev2_set_sensitivity, - .get_sensitivity = &_netdev2_get_sensitivity, - .get_rssi = &_netdev2_get_rssi, +const s_nsIf_t emb6_netdev_driver = { + .name = "netdev", + .init = &_netdev_init, + .send = &_netdev_send, + .on = &_netdev_on, + .off = &_netdev_off, + .set_txpower = &_netdev_set_txpower, + .get_txpower = &_netdev_get_txpower, + .set_sensitivity = &_netdev_set_sensitivity, + .get_sensitivity = &_netdev_get_sensitivity, + .get_rssi = &_netdev_get_rssi, .ant_div = NULL, .ant_rf_switch = NULL, - .set_promisc = &_netdev2_set_promisc, + .set_promisc = &_netdev_set_promisc, }; static void _get_recv_pkt(void) { char *dataptr; - struct netdev2_radio_rx_info rx_info; + struct netdev_radio_rx_info rx_info; int8_t len; packetbuf_clear(); @@ -80,17 +80,17 @@ static void _get_recv_pkt(void) } } -static void _event_cb(netdev2_t *dev, netdev2_event_t event) +static void _event_cb(netdev_t *dev, netdev_event_t event) { - if (event == NETDEV2_EVENT_ISR) { + if (event == NETDEV_EVENT_ISR) { /* EVENT_TYPE_PCK_LL is supposed to be used by drivers, so use it - * (though NETDEV2_EVENT_ISR technically doesn't only signify + * (though NETDEV_EVENT_ISR technically doesn't only signify * incoming packets) */ evproc_putEvent(E_EVPROC_HEAD, EVENT_TYPE_PCK_LL, NULL); } else { switch (event) { - case NETDEV2_EVENT_RX_COMPLETE: { + case NETDEV_EVENT_RX_COMPLETE: { _get_recv_pkt(); } break; @@ -100,7 +100,7 @@ static void _event_cb(netdev2_t *dev, netdev2_event_t event) } } -static void _emb6_netdev2_callback(c_event_t c_event, p_data_t p_data) +static void _emb6_netdev_callback(c_event_t c_event, p_data_t p_data) { (void)p_data; if (c_event == EVENT_TYPE_PCK_LL) { @@ -108,7 +108,7 @@ static void _emb6_netdev2_callback(c_event_t c_event, p_data_t p_data) } } -int emb6_netdev2_setup(netdev2_t *dev) +int emb6_netdev_setup(netdev_t *dev) { if (_dev == NULL) { _dev = dev; @@ -117,7 +117,7 @@ int emb6_netdev2_setup(netdev2_t *dev) return -1; } -static int8_t _netdev2_init(s_ns_t *p_ns) +static int8_t _netdev_init(s_ns_t *p_ns) { if ((_dev != NULL) && (p_ns != NULL) && (p_ns->lmac != NULL)) { _dev->event_callback = _event_cb; @@ -129,13 +129,13 @@ static int8_t _netdev2_init(s_ns_t *p_ns) sizeof(mac_phy_config.pan_id)); linkaddr_set_node_addr((linkaddr_t *)&uip_lladdr); _lowmac = p_ns->lmac; - evproc_regCallback(EVENT_TYPE_PCK_LL, _emb6_netdev2_callback); + evproc_regCallback(EVENT_TYPE_PCK_LL, _emb6_netdev_callback); return 1; } return 0; } -static int8_t _netdev2_send(const void *pr_payload, uint8_t c_len) +static int8_t _netdev_send(const void *pr_payload, uint8_t c_len) { if (_dev != NULL) { const struct iovec vector = { @@ -153,26 +153,26 @@ static int8_t _netdev2_send(const void *pr_payload, uint8_t c_len) return RADIO_TX_ERR; } -static int8_t _netdev2_on(void) +static int8_t _netdev_on(void) { - /* TODO: turn netdev2 on */ + /* TODO: turn netdev on */ return 1; } -static int8_t _netdev2_off(void) +static int8_t _netdev_off(void) { - /* TODO: turn netdev2 off */ + /* TODO: turn netdev off */ return 1; } -static void _netdev2_set_txpower(int8_t power) +static void _netdev_set_txpower(int8_t power) { int16_t pwr = power; _dev->driver->set(_dev, NETOPT_TX_POWER, &pwr, sizeof(pwr)); } -static int8_t _netdev2_get_txpower(void) +static int8_t _netdev_get_txpower(void) { int16_t power = 0; @@ -180,23 +180,23 @@ static int8_t _netdev2_get_txpower(void) return (int8_t)power; } -static void _netdev2_set_sensitivity(int8_t sens) +static void _netdev_set_sensitivity(int8_t sens) { /* TODO: set sensitivity */ } -static int8_t _netdev2_get_sensitivity(void) +static int8_t _netdev_get_sensitivity(void) { /* TODO: get sensitivity */ return 0; } -static int8_t _netdev2_get_rssi(void) +static int8_t _netdev_get_rssi(void) { return (int8_t)(_rssi_base_value + 1.03 * _last_rssi); } -static void _netdev2_set_promisc(uint8_t c_on_off) +static void _netdev_set_promisc(uint8_t c_on_off) { netopt_enable_t en = (c_on_off) ? NETOPT_ENABLE : NETOPT_DISABLE; diff --git a/pkg/emb6/contrib/target.c b/pkg/emb6/contrib/target.c index da33f0bd78..03a6a9893d 100644 --- a/pkg/emb6/contrib/target.c +++ b/pkg/emb6/contrib/target.c @@ -92,7 +92,7 @@ void hal_ledOff(uint16_t ui_led) uint8_t hal_extIntInit(en_targetExtInt_t e_extInt, pfn_intCallb_t pfn_intCallback) { - /* RIOT does this in netdev2 initialization so nothing to do here. */ + /* RIOT does this in netdev initialization so nothing to do here. */ return 0; } diff --git a/pkg/emb6/include/emb6/netdev2.h b/pkg/emb6/include/emb6/netdev.h similarity index 77% rename from pkg/emb6/include/emb6/netdev2.h rename to pkg/emb6/include/emb6/netdev.h index ca85fd8087..8bc87c6ec8 100644 --- a/pkg/emb6/include/emb6/netdev2.h +++ b/pkg/emb6/include/emb6/netdev.h @@ -7,7 +7,7 @@ */ /** - * @defgroup pkgemb6_netdev2 netdev2 wrapper for emb6 + * @defgroup pkg_emb6_netdev netdev wrapper for emb6 * @ingroup pkg_emb6 * @brief * @{ @@ -17,10 +17,10 @@ * * @author Martine Lenders */ -#ifndef EMB6_NETDEV2_H -#define EMB6_NETDEV2_H +#ifndef EMB6_NETDEV_H +#define EMB6_NETDEV_H -#include "net/netdev2.h" +#include "net/netdev.h" #include "emb6.h" @@ -36,7 +36,7 @@ extern "C" { * This variable is used by @ref board_conf() to set the interface for the * stack. */ -extern const s_nsIf_t emb6_netdev2_driver; +extern const s_nsIf_t emb6_netdev_driver; /** * @brief Setup a network device as the emb6 interface. @@ -46,11 +46,11 @@ extern const s_nsIf_t emb6_netdev2_driver; * @return 0 on success. * @return <= 0 on error. */ -int emb6_netdev2_setup(netdev2_t *dev); +int emb6_netdev_setup(netdev_t *dev); #ifdef __cplusplus } #endif -#endif /* EMB6_NETDEV2_H */ +#endif /* EMB6_NETDEV_H */ /** @} */ diff --git a/pkg/lwip/Makefile.include b/pkg/lwip/Makefile.include index 3f1e6e8f54..a570711e61 100644 --- a/pkg/lwip/Makefile.include +++ b/pkg/lwip/Makefile.include @@ -13,8 +13,8 @@ endif ifneq (,$(filter lwip_contrib,$(USEMODULE))) DIRS += $(RIOTBASE)/pkg/lwip/contrib endif -ifneq (,$(filter lwip_netdev2,$(USEMODULE))) - DIRS += $(RIOTBASE)/pkg/lwip/contrib/netdev2 +ifneq (,$(filter lwip_netdev,$(USEMODULE))) + DIRS += $(RIOTBASE)/pkg/lwip/contrib/netdev endif ifneq (,$(filter lwip_sock,$(USEMODULE))) ifneq (,$(filter lwip_ipv6,$(USEMODULE))) diff --git a/pkg/lwip/contrib/lwip.c b/pkg/lwip/contrib/lwip.c index 88584c00eb..6c3d5819d5 100644 --- a/pkg/lwip/contrib/lwip.c +++ b/pkg/lwip/contrib/lwip.c @@ -14,13 +14,13 @@ */ #include "lwip/tcpip.h" -#include "lwip/netif/netdev2.h" +#include "lwip/netif/netdev.h" #include "lwip/netif.h" #include "netif/lowpan6.h" -#ifdef MODULE_NETDEV2_TAP -#include "netdev2_tap.h" -#include "netdev2_tap_params.h" +#ifdef MODULE_NETDEV_TAP +#include "netdev_tap.h" +#include "netdev_tap_params.h" #endif #ifdef MODULE_AT86RF2XX @@ -38,8 +38,8 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#ifdef MODULE_NETDEV2_TAP -#define LWIP_NETIF_NUMOF (NETDEV2_TAP_MAX) +#ifdef MODULE_NETDEV_TAP +#define LWIP_NETIF_NUMOF (NETDEV_TAP_MAX) #endif #ifdef MODULE_AT86RF2XX /* is mutual exclusive with above ifdef */ @@ -54,8 +54,8 @@ static struct netif netif[LWIP_NETIF_NUMOF]; #endif -#ifdef MODULE_NETDEV2_TAP -static netdev2_tap_t netdev2_taps[LWIP_NETIF_NUMOF]; +#ifdef MODULE_NETDEV_TAP +static netdev_tap_t netdev_taps[LWIP_NETIF_NUMOF]; #endif #ifdef MODULE_AT86RF2XX @@ -68,21 +68,21 @@ static mrf24j40_t mrf24j40_devs[LWIP_NETIF_NUMOF]; void lwip_bootstrap(void) { - /* TODO: do for every eligable netdev2 */ + /* TODO: do for every eligable netdev */ #ifdef LWIP_NETIF_NUMOF -#ifdef MODULE_NETDEV2_TAP +#ifdef MODULE_NETDEV_TAP for (int i = 0; i < LWIP_NETIF_NUMOF; i++) { - netdev2_tap_setup(&netdev2_taps[i], &netdev2_tap_params[i]); - if (netif_add(&netif[i], &netdev2_taps[i], lwip_netdev2_init, + netdev_tap_setup(&netdev_taps[i], &netdev_tap_params[i]); + if (netif_add(&netif[i], &netdev_taps[i], lwip_netdev_init, tcpip_input) == NULL) { - DEBUG("Could not add netdev2_tap device\n"); + DEBUG("Could not add netdev_tap device\n"); return; } } #elif defined(MODULE_MRF24J40) for (int i = 0; i < LWIP_NETIF_NUMOF; i++) { mrf24j40_setup(&mrf24j40_devs[i], &mrf24j40_params[i]); - if (netif_add(&netif[i], &mrf24j40_devs[i], lwip_netdev2_init, + if (netif_add(&netif[i], &mrf24j40_devs[i], lwip_netdev_init, tcpip_6lowpan_input) == NULL) { DEBUG("Could not add mrf24j40 device\n"); return; @@ -91,7 +91,7 @@ void lwip_bootstrap(void) #elif defined(MODULE_AT86RF2XX) for (int i = 0; i < LWIP_NETIF_NUMOF; i++) { at86rf2xx_setup(&at86rf2xx_devs[i], &at86rf2xx_params[i]); - if (netif_add(&netif[i], &at86rf2xx_devs[i], lwip_netdev2_init, + if (netif_add(&netif[i], &at86rf2xx_devs[i], lwip_netdev_init, tcpip_6lowpan_input) == NULL) { DEBUG("Could not add at86rf2xx device\n"); return; @@ -99,7 +99,7 @@ void lwip_bootstrap(void) } #endif if (netif[0].state != NULL) { - /* state is set to a netdev2_t in the netif_add() functions above */ + /* state is set to a netdev_t in the netif_add() functions above */ netif_set_default(&netif[0]); } #endif diff --git a/sys/net/gnrc/link_layer/netdev2/Makefile b/pkg/lwip/contrib/netdev/Makefile similarity index 61% rename from sys/net/gnrc/link_layer/netdev2/Makefile rename to pkg/lwip/contrib/netdev/Makefile index 2cfcb37ec9..0a32fc5205 100644 --- a/sys/net/gnrc/link_layer/netdev2/Makefile +++ b/pkg/lwip/contrib/netdev/Makefile @@ -1,3 +1,3 @@ -MODULE = gnrc_netdev2 +MODULE := lwip_netdev include $(RIOTBASE)/Makefile.base diff --git a/pkg/lwip/contrib/netdev2/lwip_netdev2.c b/pkg/lwip/contrib/netdev/lwip_netdev.c similarity index 78% rename from pkg/lwip/contrib/netdev2/lwip_netdev2.c rename to pkg/lwip/contrib/netdev/lwip_netdev.c index 27d01b1524..d961777127 100644 --- a/pkg/lwip/contrib/netdev2/lwip_netdev2.c +++ b/pkg/lwip/contrib/netdev/lwip_netdev.c @@ -20,7 +20,7 @@ #include "lwip/err.h" #include "lwip/ethip6.h" #include "lwip/netif.h" -#include "lwip/netif/netdev2.h" +#include "lwip/netif/netdev.h" #include "lwip/opt.h" #include "lwip/pbuf.h" #include "netif/etharp.h" @@ -29,7 +29,7 @@ #include "net/eui64.h" #include "net/ieee802154.h" #include "net/ipv6/addr.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/netopt.h" #include "utlist.h" #include "thread.h" @@ -37,49 +37,49 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#define LWIP_NETDEV2_NAME "lwip_netdev2_mux" -#define LWIP_NETDEV2_PRIO (THREAD_PRIORITY_MAIN - 4) -#define LWIP_NETDEV2_STACKSIZE (THREAD_STACKSIZE_DEFAULT) -#define LWIP_NETDEV2_QUEUE_LEN (8) -#define LWIP_NETDEV2_MSG_TYPE_EVENT 0x1235 +#define LWIP_NETDEV_NAME "lwip_netdev_mux" +#define LWIP_NETDEV_PRIO (THREAD_PRIORITY_MAIN - 4) +#define LWIP_NETDEV_STACKSIZE (THREAD_STACKSIZE_DEFAULT) +#define LWIP_NETDEV_QUEUE_LEN (8) +#define LWIP_NETDEV_MSG_TYPE_EVENT 0x1235 #define ETHERNET_IFNAME1 'E' #define ETHERNET_IFNAME2 'T' static kernel_pid_t _pid = KERNEL_PID_UNDEF; -static char _stack[LWIP_NETDEV2_STACKSIZE]; -static msg_t _queue[LWIP_NETDEV2_QUEUE_LEN]; -static char _tmp_buf[LWIP_NETDEV2_BUFLEN]; +static char _stack[LWIP_NETDEV_STACKSIZE]; +static msg_t _queue[LWIP_NETDEV_QUEUE_LEN]; +static char _tmp_buf[LWIP_NETDEV_BUFLEN]; -#ifdef MODULE_NETDEV2_ETH +#ifdef MODULE_NETDEV_ETH static err_t _eth_link_output(struct netif *netif, struct pbuf *p); #endif #ifdef MODULE_LWIP_SIXLOWPAN static err_t _ieee802154_link_output(struct netif *netif, struct pbuf *p); #endif -static void _event_cb(netdev2_t *dev, netdev2_event_t event); +static void _event_cb(netdev_t *dev, netdev_event_t event); static void *_event_loop(void *arg); -err_t lwip_netdev2_init(struct netif *netif) +err_t lwip_netdev_init(struct netif *netif) { LWIP_ASSERT("netif != NULL", (netif != NULL)); LWIP_ASSERT("netif->state != NULL", (netif->state != NULL)); - netdev2_t *netdev; + netdev_t *netdev; uint16_t dev_type; err_t res = ERR_OK; /* start multiplexing thread (only one needed) */ if (_pid <= KERNEL_PID_UNDEF) { - _pid = thread_create(_stack, LWIP_NETDEV2_STACKSIZE, LWIP_NETDEV2_PRIO, + _pid = thread_create(_stack, LWIP_NETDEV_STACKSIZE, LWIP_NETDEV_PRIO, THREAD_CREATE_STACKTEST, _event_loop, netif, - LWIP_NETDEV2_NAME); + LWIP_NETDEV_NAME); if (_pid <= 0) { return ERR_IF; } } /* initialize netdev and netif */ - netdev = (netdev2_t *)netif->state; + netdev = (netdev_t *)netif->state; netdev->driver->init(netdev); netdev->event_callback = _event_cb; if (netdev->driver->get(netdev, NETOPT_DEVICE_TYPE, &dev_type, @@ -90,10 +90,10 @@ err_t lwip_netdev2_init(struct netif *netif) netif->hostname = "riot"; #endif /* LWIP_NETIF_HOSTNAME */ - /* XXX: for now assume its Ethernet, since netdev2 is implemented only by ethernet drivers */ + /* XXX: for now assume its Ethernet, since netdev is implemented only by ethernet drivers */ switch (dev_type) { -#ifdef MODULE_NETDEV2_ETH - case NETDEV2_TYPE_ETHERNET: +#ifdef MODULE_NETDEV_ETH + case NETDEV_TYPE_ETHERNET: netif->name[0] = ETHERNET_IFNAME1; netif->name[1] = ETHERNET_IFNAME2; netif->hwaddr_len = (u8_t)netdev->driver->get(netdev, NETOPT_ADDRESS, netif->hwaddr, @@ -101,7 +101,7 @@ err_t lwip_netdev2_init(struct netif *netif) if (netif->hwaddr_len > sizeof(netif->hwaddr)) { return ERR_IF; } - /* TODO: get from driver (currently not in netdev2_eth) */ + /* TODO: get from driver (currently not in netdev_eth) */ netif->mtu = ETHERNET_DATA_LEN; netif->linkoutput = _eth_link_output; #if LWIP_IPV4 @@ -117,7 +117,7 @@ err_t lwip_netdev2_init(struct netif *netif) break; #endif #ifdef MODULE_LWIP_SIXLOWPAN - case NETDEV2_TYPE_IEEE802154: + case NETDEV_TYPE_IEEE802154: { u16_t val; ipv6_addr_t *addr; @@ -174,10 +174,10 @@ err_t lwip_netdev2_init(struct netif *netif) return res; } -#ifdef MODULE_NETDEV2_ETH +#ifdef MODULE_NETDEV_ETH static err_t _eth_link_output(struct netif *netif, struct pbuf *p) { - netdev2_t *netdev = (netdev2_t *)netif->state; + netdev_t *netdev = (netdev_t *)netif->state; struct pbuf *q; unsigned int count = 0; @@ -201,7 +201,7 @@ static err_t _eth_link_output(struct netif *netif, struct pbuf *p) static err_t _ieee802154_link_output(struct netif *netif, struct pbuf *p) { LWIP_ASSERT("p->next == NULL", p->next == NULL); - netdev2_t *netdev = (netdev2_t *)netif->state; + netdev_t *netdev = (netdev_t *)netif->state; struct iovec pkt = { .iov_base = p->payload, .iov_len = (p->len - IEEE802154_FCS_LEN), /* FCS is written by driver */ @@ -211,7 +211,7 @@ static err_t _ieee802154_link_output(struct netif *netif, struct pbuf *p) } #endif -static struct pbuf *_get_recv_pkt(netdev2_t *dev) +static struct pbuf *_get_recv_pkt(netdev_t *dev) { int len = dev->driver->recv(dev, _tmp_buf, sizeof(_tmp_buf), NULL); @@ -219,37 +219,37 @@ static struct pbuf *_get_recv_pkt(netdev2_t *dev) struct pbuf *p = pbuf_alloc(PBUF_RAW, (u16_t)len, PBUF_POOL); if (p == NULL) { - DEBUG("lwip_netdev2: can not allocate in pbuf\n"); + DEBUG("lwip_netdev: can not allocate in pbuf\n"); return NULL; } pbuf_take(p, _tmp_buf, len); return p; } -static void _event_cb(netdev2_t *dev, netdev2_event_t event) +static void _event_cb(netdev_t *dev, netdev_event_t event) { - if (event == NETDEV2_EVENT_ISR) { + if (event == NETDEV_EVENT_ISR) { assert(_pid != KERNEL_PID_UNDEF); msg_t msg; - msg.type = LWIP_NETDEV2_MSG_TYPE_EVENT; + msg.type = LWIP_NETDEV_MSG_TYPE_EVENT; msg.content.ptr = dev; if (msg_send(&msg, _pid) <= 0) { - DEBUG("lwip_netdev2: possibly lost interrupt.\n"); + DEBUG("lwip_netdev: possibly lost interrupt.\n"); } } else { struct netif *netif = dev->context; switch (event) { - case NETDEV2_EVENT_RX_COMPLETE: { + case NETDEV_EVENT_RX_COMPLETE: { struct pbuf *p = _get_recv_pkt(dev); if (p == NULL) { - DEBUG("lwip_netdev2: error receiving packet\n"); + DEBUG("lwip_netdev: error receiving packet\n"); return; } if (netif->input(p, netif) != ERR_OK) { - DEBUG("lwip_netdev2: error inputing packet\n"); + DEBUG("lwip_netdev: error inputing packet\n"); return; } } @@ -263,12 +263,12 @@ static void _event_cb(netdev2_t *dev, netdev2_event_t event) static void *_event_loop(void *arg) { (void)arg; - msg_init_queue(_queue, LWIP_NETDEV2_QUEUE_LEN); + msg_init_queue(_queue, LWIP_NETDEV_QUEUE_LEN); while (1) { msg_t msg; msg_receive(&msg); - if (msg.type == LWIP_NETDEV2_MSG_TYPE_EVENT) { - netdev2_t *dev = msg.content.ptr; + if (msg.type == LWIP_NETDEV_MSG_TYPE_EVENT) { + netdev_t *dev = msg.content.ptr; dev->driver->isr(dev); } } diff --git a/pkg/lwip/include/lwip/netif/netdev2.h b/pkg/lwip/include/lwip/netif/netdev.h similarity index 65% rename from pkg/lwip/include/lwip/netif/netdev2.h rename to pkg/lwip/include/lwip/netif/netdev.h index 0af5102148..29cc028a2b 100644 --- a/pkg/lwip/include/lwip/netif/netdev2.h +++ b/pkg/lwip/include/lwip/netif/netdev.h @@ -7,21 +7,21 @@ */ /** - * @defgroup pkg_lwip_netdev2 lwIP netdev2 adapter + * @defgroup pkg_lwip_netdev lwIP netdev adapter * @ingroup pkg_lwip - * @brief netdev2 adapter for lwIP + * @brief netdev adapter for lwIP * @{ * * @file - * @brief lwIP netdev2 adapter definitions + * @brief lwIP netdev adapter definitions * * @author Martine Lenders */ -#ifndef LWIP_NETDEV2_H -#define LWIP_NETDEV2_H +#ifndef LWIP_NETDEV_H +#define LWIP_NETDEV_H #include "net/ethernet.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "lwip/err.h" #include "lwip/netif.h" @@ -35,28 +35,28 @@ extern "C" { * @brief Length of the temporary copying buffer for receival. * @note It should be as long as the maximum packet length of all the netdev you use. */ -#ifndef LWIP_NETDEV2_BUFLEN -#define LWIP_NETDEV2_BUFLEN (ETHERNET_MAX_LEN) +#ifndef LWIP_NETDEV_BUFLEN +#define LWIP_NETDEV_BUFLEN (ETHERNET_MAX_LEN) #endif /** - * @brief Initializes the netdev2 adapter. + * @brief Initializes the netdev adapter. * * Should be passed to lwIP's netif_add() with the state parameter parameter of that function set - * to an existing netdev2_t instance + * to an existing netdev_t instance * - * @pre netif->state is set to an existing netdev2_t instance. + * @pre netif->state is set to an existing netdev_t instance. * * @param[in] netif The network interface intended to be initialized. * * @return ERR_OK on success. * @return ERR_IF on error. */ -err_t lwip_netdev2_init(struct netif *netif); +err_t lwip_netdev_init(struct netif *netif); #ifdef __cplusplus } #endif -#endif /* LWIP_NETDEV2_H */ +#endif /* LWIP_NETDEV_H */ /** @} */ diff --git a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c index 9f2727a8cf..b0f71eb244 100644 --- a/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c +++ b/pkg/nordic_softdevice_ble/src/gnrc_nordic_ble_6lowpan.c @@ -209,7 +209,7 @@ static int _handle_get(gnrc_netapi_opt_t *_opt) #endif /* case NETOPT_DEVICE_TYPE: assert(_opt->data_len == sizeof(uint16_t)); - *((uint16_t *)value) = NETDEV2_TYPE_IEEE802154; + *((uint16_t *)value) = NETDEV_TYPE_IEEE802154; res = sizeof(uint16_t); break;*/ case NETOPT_IPV6_IID: diff --git a/release-notes.txt b/release-notes.txt index 0ca54d17fa..b3da30c93b 100644 --- a/release-notes.txt +++ b/release-notes.txt @@ -67,7 +67,7 @@ Networking * Provide sock-port for GCOAP * Provide sock-port for UHCPC * Provide sock_ip wrapper for LWIP -* Native: allow for multiple netdev2_tap devices +* Native: allow for multiple netdev_tap devices Packages -------- @@ -100,9 +100,9 @@ Drivers * Unified NRF5x low power modes + Low power modes for the STM32F1 family * Unified Kinetis low power modes -* Xbee port to netdev2 API -* W5100 port to netdev2 API -* NRF5x/'nrfmin' port to netdev2 API (w/o 6LoWPAN support currently) +* Xbee port to netdev API +* W5100 port to netdev API +* NRF5x/'nrfmin' port to netdev API (w/o 6LoWPAN support currently) * Refactor synchronous UART by new 'isrpipe' module Build System @@ -340,7 +340,7 @@ Core API changes ----------- + Socket-like sock API (replacing conn) -* netdev2: Add Testmodes and CCA modes +* netdev: Add Testmodes and CCA modes * IEEE 802.15.4: clean-up Intra-PAN behavior * IEEE 802.15.4: centralize default values * gnrc_pktbuf: allow for 0-sized snips @@ -411,7 +411,7 @@ Fixed Issues from the last release ================================== #534: native debugging on osx fails #2071: native: *long* overdue fixes -#3341: netdev2_tap crashes when hammered +#3341: netdev_tap crashes when hammered #5007: gnrc icmpv6: Ping reply goes out the wrong interface #5432: native: valgrind fails @@ -863,7 +863,7 @@ Core Network Stack --- + P2P-RPL (RFC6997) -+ netdev2_test: test framework for users of the netdev2 API ++ netdev_test: test framework for users of the netdev API Packages --- @@ -905,7 +905,7 @@ Other API changes --- -* at86rf2xx was moved from gnrc_netdev to the netdev2 API +* at86rf2xx was moved from gnrc_netdev to the netdev API * genrand_* -> random_* * xtimer_remove() no longer returns whether a timer was actually removed * disableIRQ(), enableIRQ(), restoreIRQ(), inISR() -> irq_disable(), irq_enable(), irq_restore(), irq_is_in() diff --git a/sys/Makefile b/sys/Makefile index 78a120f685..d25fb28e33 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -25,8 +25,8 @@ endif ifneq (,$(filter ieee802154,$(USEMODULE))) DIRS += net/link_layer/ieee802154 endif -ifneq (,$(filter netdev2_test,$(USEMODULE))) - DIRS += net/netdev2_test +ifneq (,$(filter netdev_test,$(USEMODULE))) + DIRS += net/netdev_test endif ifneq (,$(filter icmpv6,$(USEMODULE))) DIRS += net/network_layer/icmpv6 @@ -58,8 +58,8 @@ endif ifneq (,$(filter nhdp,$(USEMODULE))) DIRS += net/routing/nhdp endif -ifneq (,$(filter gnrc_netdev2,$(USEMODULE))) - DIRS += net/gnrc/link_layer/netdev2 +ifneq (,$(filter gnrc_netdev,$(USEMODULE))) + DIRS += net/gnrc/link_layer/netdev endif ifneq (,$(filter fib,$(USEMODULE))) DIRS += net/network_layer/fib diff --git a/sys/auto_init/auto_init.c b/sys/auto_init/auto_init.c index 5169fa97d9..4a20d9dfb0 100644 --- a/sys/auto_init/auto_init.c +++ b/sys/auto_init/auto_init.c @@ -216,9 +216,9 @@ void auto_init(void) auto_init_kw2xrf(); #endif -#ifdef MODULE_NETDEV2_TAP - extern void auto_init_netdev2_tap(void); - auto_init_netdev2_tap(); +#ifdef MODULE_NETDEV_TAP + extern void auto_init_netdev_tap(void); + auto_init_netdev_tap(); #endif #ifdef MODULE_NORDIC_SOFTDEVICE_BLE diff --git a/sys/auto_init/netif/auto_init_at86rf2xx.c b/sys/auto_init/netif/auto_init_at86rf2xx.c index 2ed734a368..88ba50284e 100644 --- a/sys/auto_init/netif/auto_init_at86rf2xx.c +++ b/sys/auto_init/netif/auto_init_at86rf2xx.c @@ -21,8 +21,8 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/ieee802154.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/ieee802154.h" #include "net/gnrc.h" #include "at86rf2xx.h" @@ -34,13 +34,13 @@ */ #define AT86RF2XX_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef AT86RF2XX_MAC_PRIO -#define AT86RF2XX_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define AT86RF2XX_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif #define AT86RF2XX_NUM (sizeof(at86rf2xx_params) / sizeof(at86rf2xx_params[0])) static at86rf2xx_t at86rf2xx_devs[AT86RF2XX_NUM]; -static gnrc_netdev2_t gnrc_adpt[AT86RF2XX_NUM]; +static gnrc_netdev_t gnrc_adpt[AT86RF2XX_NUM]; static char _at86rf2xx_stacks[AT86RF2XX_NUM][AT86RF2XX_MAC_STACKSIZE]; void auto_init_at86rf2xx(void) @@ -51,18 +51,18 @@ void auto_init_at86rf2xx(void) LOG_DEBUG("[auto_init_netif] initializing at86rf2xx #%u\n", i); at86rf2xx_setup(&at86rf2xx_devs[i], &at86rf2xx_params[i]); - res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i], - (netdev2_ieee802154_t *)&at86rf2xx_devs[i]); + res = gnrc_netdev_ieee802154_init(&gnrc_adpt[i], + (netdev_ieee802154_t *)&at86rf2xx_devs[i]); if (res < 0) { LOG_ERROR("[auto_init_netif] error initializing at86rf2xx radio #%u\n", i); } else { - gnrc_netdev2_init(_at86rf2xx_stacks[i], - AT86RF2XX_MAC_STACKSIZE, - AT86RF2XX_MAC_PRIO, - "at86rf2xx", - &gnrc_adpt[i]); + gnrc_netdev_init(_at86rf2xx_stacks[i], + AT86RF2XX_MAC_STACKSIZE, + AT86RF2XX_MAC_PRIO, + "at86rf2xx", + &gnrc_adpt[i]); } } } diff --git a/sys/auto_init/netif/auto_init_cc110x.c b/sys/auto_init/netif/auto_init_cc110x.c index ba48332421..a5faba120f 100644 --- a/sys/auto_init/netif/auto_init_cc110x.c +++ b/sys/auto_init/netif/auto_init_cc110x.c @@ -22,8 +22,8 @@ #include "log.h" #include "debug.h" #include "board.h" -#include "net/gnrc/netdev2.h" -#include "gnrc_netdev2_cc110x.h" +#include "net/gnrc/netdev.h" +#include "gnrc_netdev_cc110x.h" #include "net/gnrc.h" #include "cc110x.h" @@ -35,15 +35,15 @@ */ #define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #ifndef CC110X_MAC_PRIO -#define CC110X_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define CC110X_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif #define CC110X_NUM (sizeof(cc110x_params)/sizeof(cc110x_params[0])) -static netdev2_cc110x_t cc110x_devs[CC110X_NUM]; +static netdev_cc110x_t cc110x_devs[CC110X_NUM]; static char _stacks[CC110X_NUM][CC110X_MAC_STACKSIZE]; -static gnrc_netdev2_t _gnrc_netdev2_devs[CC110X_NUM]; +static gnrc_netdev_t _gnrc_netdev_devs[CC110X_NUM]; void auto_init_cc110x(void) { @@ -52,14 +52,14 @@ void auto_init_cc110x(void) LOG_DEBUG("[auto_init_netif] initializing cc110x #%u\n", i); - int res = netdev2_cc110x_setup(&cc110x_devs[i], p); + int res = netdev_cc110x_setup(&cc110x_devs[i], p); if (res < 0) { LOG_ERROR("[auto_init_netif] error initializing cc110x #%u\n", i); } else { - gnrc_netdev2_cc110x_init(&_gnrc_netdev2_devs[i], &cc110x_devs[i]); - res = gnrc_netdev2_init(_stacks[i], CC110X_MAC_STACKSIZE, - CC110X_MAC_PRIO, "cc110x", &_gnrc_netdev2_devs[i]); + gnrc_netdev_cc110x_init(&_gnrc_netdev_devs[i], &cc110x_devs[i]); + res = gnrc_netdev_init(_stacks[i], CC110X_MAC_STACKSIZE, + CC110X_MAC_PRIO, "cc110x", &_gnrc_netdev_devs[i]); if (res < 0) { LOG_ERROR("[auto_init_netif] error starting gnrc_cc110x thread\n"); } diff --git a/sys/auto_init/netif/auto_init_cc2420.c b/sys/auto_init/netif/auto_init_cc2420.c index 636a4715bb..b430582eb3 100644 --- a/sys/auto_init/netif/auto_init_cc2420.c +++ b/sys/auto_init/netif/auto_init_cc2420.c @@ -23,8 +23,8 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/ieee802154.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/ieee802154.h" #include "net/gnrc.h" #include "cc2420.h" @@ -36,7 +36,7 @@ */ #define CC2420_MAC_STACKSIZE (THREAD_STACKSIZE_MAIN) #ifndef CC2420_MAC_PRIO -#define CC2420_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define CC2420_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif /** @} */ @@ -50,7 +50,7 @@ * @{ */ static cc2420_t cc2420_devs[CC2420_NUMOF]; -static gnrc_netdev2_t gnrc_adpt[CC2420_NUMOF]; +static gnrc_netdev_t gnrc_adpt[CC2420_NUMOF]; static char _cc2420_stacks[CC2420_NUMOF][CC2420_MAC_STACKSIZE]; /** @} */ @@ -60,17 +60,17 @@ void auto_init_cc2420(void) LOG_DEBUG("[auto_init_netif] initializing cc2420 #%u\n", i); cc2420_setup(&cc2420_devs[i], &cc2420_params[i]); - int res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i], - (netdev2_ieee802154_t *)&cc2420_devs[i]); + int res = gnrc_netdev_ieee802154_init(&gnrc_adpt[i], + (netdev_ieee802154_t *)&cc2420_devs[i]); if (res < 0) { LOG_ERROR("[auto_init_netif] error initializing cc2420 #%u\n", i); } else { - gnrc_netdev2_init(_cc2420_stacks[i], - CC2420_MAC_STACKSIZE, - CC2420_MAC_PRIO, - "cc2420", &gnrc_adpt[i]); + gnrc_netdev_init(_cc2420_stacks[i], + CC2420_MAC_STACKSIZE, + CC2420_MAC_PRIO, + "cc2420", &gnrc_adpt[i]); } } } diff --git a/sys/auto_init/netif/auto_init_cc2538_rf.c b/sys/auto_init/netif/auto_init_cc2538_rf.c index 8bb1415e42..29c896c30a 100644 --- a/sys/auto_init/netif/auto_init_cc2538_rf.c +++ b/sys/auto_init/netif/auto_init_cc2538_rf.c @@ -20,8 +20,8 @@ #ifdef MODULE_CC2538_RF #include "log.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/ieee802154.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/ieee802154.h" #include "cc2538_rf.h" @@ -31,11 +31,11 @@ */ #define CC2538_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef CC2538_MAC_PRIO -#define CC2538_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define CC2538_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif static cc2538_rf_t cc2538_rf_dev; -static gnrc_netdev2_t gnrc_adpt; +static gnrc_netdev_t gnrc_adpt; static char _cc2538_rf_stack[CC2538_MAC_STACKSIZE]; void auto_init_cc2538_rf(void) @@ -45,18 +45,18 @@ void auto_init_cc2538_rf(void) LOG_DEBUG("[auto_init_netif] initializing cc2538 radio\n"); cc2538_setup(&cc2538_rf_dev); - res = gnrc_netdev2_ieee802154_init(&gnrc_adpt, - (netdev2_ieee802154_t *)&cc2538_rf_dev); + res = gnrc_netdev_ieee802154_init(&gnrc_adpt, + (netdev_ieee802154_t *)&cc2538_rf_dev); if (res < 0) { LOG_ERROR("[auto_init_netif] error initializing cc2538 radio\n"); } else { - gnrc_netdev2_init(_cc2538_rf_stack, - CC2538_MAC_STACKSIZE, - CC2538_MAC_PRIO, - "cc2538_rf", - &gnrc_adpt); + gnrc_netdev_init(_cc2538_rf_stack, + CC2538_MAC_STACKSIZE, + CC2538_MAC_PRIO, + "cc2538_rf", + &gnrc_adpt); } } diff --git a/sys/auto_init/netif/auto_init_enc28j60.c b/sys/auto_init/netif/auto_init_enc28j60.c index 8050006e13..a8ca61f969 100644 --- a/sys/auto_init/netif/auto_init_enc28j60.c +++ b/sys/auto_init/netif/auto_init_enc28j60.c @@ -24,8 +24,8 @@ #include "log.h" #include "enc28j60.h" #include "enc28j60_params.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/eth.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/eth.h" /** * @brief Define stack parameters for the MAC layer thread @@ -33,7 +33,7 @@ */ #define ENC28J60_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef ENC28J60_MAC_PRIO -#define ENC28J60_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define ENC28J60_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif /*** @} */ @@ -47,7 +47,7 @@ * @{ */ static enc28j60_t dev[ENC28J60_NUM]; -static gnrc_netdev2_t gnrc_adpt[ENC28J60_NUM]; +static gnrc_netdev_t gnrc_adpt[ENC28J60_NUM]; /** @} */ /** @@ -61,13 +61,13 @@ void auto_init_enc28j60(void) for (unsigned i = 0; i < ENC28J60_NUM; i++) { LOG_DEBUG("[auto_init_netif] initializing enc28j60 #%u\n", i); - /* setup netdev2 device */ + /* setup netdev device */ enc28j60_setup(&dev[i], &enc28j60_params[i]); - /* initialize netdev2 <-> gnrc adapter state */ - gnrc_netdev2_eth_init(&gnrc_adpt[i], (netdev2_t *)&dev[i]); - /* start gnrc netdev2 thread */ - gnrc_netdev2_init(stack[i], ENC28J60_MAC_STACKSIZE, ENC28J60_MAC_PRIO, - "gnrc_enc28j60", &gnrc_adpt[i]); + /* initialize netdev <-> gnrc adapter state */ + gnrc_netdev_eth_init(&gnrc_adpt[i], (netdev_t *)&dev[i]); + /* start gnrc netdev thread */ + gnrc_netdev_init(stack[i], ENC28J60_MAC_STACKSIZE, ENC28J60_MAC_PRIO, + "gnrc_enc28j60", &gnrc_adpt[i]); } } diff --git a/sys/auto_init/netif/auto_init_encx24j600.c b/sys/auto_init/netif/auto_init_encx24j600.c index cafe3bb7d8..03b4633bc4 100644 --- a/sys/auto_init/netif/auto_init_encx24j600.c +++ b/sys/auto_init/netif/auto_init_encx24j600.c @@ -22,8 +22,8 @@ #include "log.h" #include "debug.h" #include "encx24j600.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/eth.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/eth.h" static encx24j600_t encx24j600; @@ -33,33 +33,33 @@ static encx24j600_t encx24j600; */ #define ENCX24J600_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #ifndef ENCX24J600_MAC_PRIO -#define ENCX24J600_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define ENCX24J600_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif /** * @brief Stacks for the MAC layer threads */ -static char _netdev2_eth_stack[ENCX24J600_MAC_STACKSIZE]; -static gnrc_netdev2_t _gnrc_encx24j600; +static char _netdev_eth_stack[ENCX24J600_MAC_STACKSIZE]; +static gnrc_netdev_t _gnrc_encx24j600; void auto_init_encx24j600(void) { LOG_DEBUG("[auto_init_netif] initializing encx24j600 #0\n"); - /* setup netdev2 device */ + /* setup netdev device */ encx24j600_params_t p; p.spi = ENCX24J600_SPI; p.cs_pin = ENCX24J600_CS; p.int_pin = ENCX24J600_INT; encx24j600_setup(&encx24j600, &p); - /* initialize netdev2<->gnrc adapter state */ - gnrc_netdev2_eth_init(&_gnrc_encx24j600, (netdev2_t*)&encx24j600); + /* initialize netdev<->gnrc adapter state */ + gnrc_netdev_eth_init(&_gnrc_encx24j600, (netdev_t*)&encx24j600); - /* start gnrc netdev2 thread */ - gnrc_netdev2_init(_netdev2_eth_stack, ENCX24J600_MAC_STACKSIZE, - ENCX24J600_MAC_PRIO, "gnrc_encx24j600", - &_gnrc_encx24j600); + /* start gnrc netdev thread */ + gnrc_netdev_init(_netdev_eth_stack, ENCX24J600_MAC_STACKSIZE, + ENCX24J600_MAC_PRIO, "gnrc_encx24j600", + &_gnrc_encx24j600); } #else diff --git a/sys/auto_init/netif/auto_init_ethos.c b/sys/auto_init/netif/auto_init_ethos.c index dd81bd1e44..b3fe15fef4 100644 --- a/sys/auto_init/netif/auto_init_ethos.c +++ b/sys/auto_init/netif/auto_init_ethos.c @@ -23,8 +23,8 @@ #include "debug.h" #include "ethos.h" #include "periph/uart.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/eth.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/eth.h" /** * @brief global ethos object, used by uart_stdio @@ -37,14 +37,14 @@ ethos_t ethos; */ #define ETHOS_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #ifndef ETHOS_MAC_PRIO -#define ETHOS_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define ETHOS_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif /** * @brief Stacks for the MAC layer threads */ -static char _netdev2_eth_stack[ETHOS_MAC_STACKSIZE]; -static gnrc_netdev2_t _gnrc_ethos; +static char _netdev_eth_stack[ETHOS_MAC_STACKSIZE]; +static gnrc_netdev_t _gnrc_ethos; static uint8_t _inbuf[2048]; @@ -52,7 +52,7 @@ void auto_init_ethos(void) { LOG_DEBUG("[auto_init_netif] initializing ethos #0\n"); - /* setup netdev2 device */ + /* setup netdev device */ ethos_params_t p; p.uart = ETHOS_UART; p.baudrate = ETHOS_BAUDRATE; @@ -60,12 +60,12 @@ void auto_init_ethos(void) p.bufsize = sizeof(_inbuf); ethos_setup(ðos, &p); - /* initialize netdev2<->gnrc adapter state */ - gnrc_netdev2_eth_init(&_gnrc_ethos, (netdev2_t*)ðos); + /* initialize netdev<->gnrc adapter state */ + gnrc_netdev_eth_init(&_gnrc_ethos, (netdev_t*)ðos); - /* start gnrc netdev2 thread */ - gnrc_netdev2_init(_netdev2_eth_stack, ETHOS_MAC_STACKSIZE, ETHOS_MAC_PRIO, - "gnrc_ethos", &_gnrc_ethos); + /* start gnrc netdev thread */ + gnrc_netdev_init(_netdev_eth_stack, ETHOS_MAC_STACKSIZE, ETHOS_MAC_PRIO, + "gnrc_ethos", &_gnrc_ethos); } #else diff --git a/sys/auto_init/netif/auto_init_kw2xrf.c b/sys/auto_init/netif/auto_init_kw2xrf.c index 1e8399a745..3f8b5afeff 100644 --- a/sys/auto_init/netif/auto_init_kw2xrf.c +++ b/sys/auto_init/netif/auto_init_kw2xrf.c @@ -24,8 +24,8 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/ieee802154.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/ieee802154.h" #include "net/gnrc.h" #include "kw2xrf.h" @@ -37,13 +37,13 @@ */ #define KW2XRF_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef KW2XRF_MAC_PRIO -#define KW2XRF_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define KW2XRF_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif #define KW2XRF_NUM (sizeof(kw2xrf_params)/sizeof(kw2xrf_params[0])) static kw2xrf_t kw2xrf_devs[KW2XRF_NUM]; -static gnrc_netdev2_t gnrc_adpt[KW2XRF_NUM]; +static gnrc_netdev_t gnrc_adpt[KW2XRF_NUM]; static char _kw2xrf_stacks[KW2XRF_NUM][KW2XRF_MAC_STACKSIZE]; void auto_init_kw2xrf(void) @@ -53,12 +53,12 @@ void auto_init_kw2xrf(void) LOG_DEBUG("[auto_init_netif] initializing kw2xrf #%u\n", i); kw2xrf_setup(&kw2xrf_devs[i], (kw2xrf_params_t*) p); - if (gnrc_netdev2_ieee802154_init(&gnrc_adpt[i], (netdev2_ieee802154_t *)&kw2xrf_devs[i]) < 0) { + if (gnrc_netdev_ieee802154_init(&gnrc_adpt[i], (netdev_ieee802154_t *)&kw2xrf_devs[i]) < 0) { LOG_ERROR("[auto_init_netif] error, initializing kw2xrf #%u\n", i); } else { - gnrc_netdev2_init(_kw2xrf_stacks[i], KW2XRF_MAC_STACKSIZE, - KW2XRF_MAC_PRIO, "kw2xrf", &gnrc_adpt[i]); + gnrc_netdev_init(_kw2xrf_stacks[i], KW2XRF_MAC_STACKSIZE, + KW2XRF_MAC_PRIO, "kw2xrf", &gnrc_adpt[i]); } } } diff --git a/sys/auto_init/netif/auto_init_mrf24j40.c b/sys/auto_init/netif/auto_init_mrf24j40.c index 18d57de88a..41c2db40f1 100644 --- a/sys/auto_init/netif/auto_init_mrf24j40.c +++ b/sys/auto_init/netif/auto_init_mrf24j40.c @@ -21,8 +21,8 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/ieee802154.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/ieee802154.h" #include "net/gnrc.h" #include "mrf24j40.h" @@ -34,13 +34,13 @@ */ #define MRF24J40_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef MRF24J40_MAC_PRIO -#define MRF24J40_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define MRF24J40_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif #define MRF24J40_NUM (sizeof(mrf24j40_params) / sizeof(mrf24j40_params[0])) static mrf24j40_t mrf24j40_devs[MRF24J40_NUM]; -static gnrc_netdev2_t gnrc_adpt[MRF24J40_NUM]; +static gnrc_netdev_t gnrc_adpt[MRF24J40_NUM]; static char _mrf24j40_stacks[MRF24J40_NUM][MRF24J40_MAC_STACKSIZE]; void auto_init_mrf24j40(void) @@ -51,18 +51,18 @@ void auto_init_mrf24j40(void) LOG_DEBUG("[auto_init_netif] initializing mrf24j40 #%u\n", i); mrf24j40_setup(&mrf24j40_devs[i], &mrf24j40_params[i]); - res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i], - (netdev2_ieee802154_t *)&mrf24j40_devs[i]); + res = gnrc_netdev_ieee802154_init(&gnrc_adpt[i], + (netdev_ieee802154_t *)&mrf24j40_devs[i]); if (res < 0) { LOG_ERROR("[auto_init_netif] error initializing mrf24j40 #%u\n", i); } else { - gnrc_netdev2_init(_mrf24j40_stacks[i], - MRF24J40_MAC_STACKSIZE, - MRF24J40_MAC_PRIO, - "mrf24j40", - &gnrc_adpt[i]); + gnrc_netdev_init(_mrf24j40_stacks[i], + MRF24J40_MAC_STACKSIZE, + MRF24J40_MAC_PRIO, + "mrf24j40", + &gnrc_adpt[i]); } } } diff --git a/sys/auto_init/netif/auto_init_netdev2_tap.c b/sys/auto_init/netif/auto_init_netdev2_tap.c deleted file mode 100644 index 23bbf9c3cd..0000000000 --- a/sys/auto_init/netif/auto_init_netdev2_tap.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2015 Kaspar Schleiser - * - * 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. - * - */ - -/** - * @ingroup auto_init_gnrc_netif - * @{ - * - * @file - * @brief Auto initialization for ethernet devices - * - * @author Kaspar Schleiser - */ - -#ifdef MODULE_NETDEV2_TAP - -#include "log.h" -#include "debug.h" -#include "netdev2_tap_params.h" -#include "net/gnrc/netdev2/eth.h" - -#define TAP_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) -#define TAP_MAC_PRIO (THREAD_PRIORITY_MAIN - 3) - -static netdev2_tap_t netdev2_tap[NETDEV2_TAP_MAX]; -static char _netdev2_eth_stack[NETDEV2_TAP_MAX][TAP_MAC_STACKSIZE + DEBUG_EXTRA_STACKSIZE]; -static gnrc_netdev2_t _gnrc_netdev2_tap[NETDEV2_TAP_MAX]; - -void auto_init_netdev2_tap(void) -{ - for (unsigned i = 0; i < NETDEV2_TAP_MAX; i++) { - const netdev2_tap_params_t *p = &netdev2_tap_params[i]; - - LOG_DEBUG("[auto_init_netif] initializing netdev2_tap #%u on TAP %s\n", - i, *(p->tap_name)); - - netdev2_tap_setup(&netdev2_tap[i], p); - gnrc_netdev2_eth_init(&_gnrc_netdev2_tap[i], (netdev2_t*)&netdev2_tap[i]); - - gnrc_netdev2_init(_netdev2_eth_stack[i], TAP_MAC_STACKSIZE, - TAP_MAC_PRIO, "gnrc_netdev2_tap", - &_gnrc_netdev2_tap[i]); - } -} - -#else -typedef int dont_be_pedantic; -#endif /* MODULE_NETDEV2_TAP */ -/** @} */ diff --git a/sys/auto_init/netif/auto_init_netdev_tap.c b/sys/auto_init/netif/auto_init_netdev_tap.c new file mode 100644 index 0000000000..8e2ccd2059 --- /dev/null +++ b/sys/auto_init/netif/auto_init_netdev_tap.c @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2015 Kaspar Schleiser + * + * 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. + * + */ + +/** + * @ingroup auto_init_gnrc_netif + * @{ + * + * @file + * @brief Auto initialization for ethernet devices + * + * @author Kaspar Schleiser + */ + +#ifdef MODULE_NETDEV_TAP + +#include "log.h" +#include "debug.h" +#include "netdev_tap_params.h" +#include "net/gnrc/netdev/eth.h" + +#define TAP_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) +#define TAP_MAC_PRIO (THREAD_PRIORITY_MAIN - 3) + +static netdev_tap_t netdev_tap[NETDEV_TAP_MAX]; +static char _netdev_eth_stack[NETDEV_TAP_MAX][TAP_MAC_STACKSIZE + DEBUG_EXTRA_STACKSIZE]; +static gnrc_netdev_t _gnrc_netdev_tap[NETDEV_TAP_MAX]; + +void auto_init_netdev_tap(void) +{ + for (unsigned i = 0; i < NETDEV_TAP_MAX; i++) { + const netdev_tap_params_t *p = &netdev_tap_params[i]; + + LOG_DEBUG("[auto_init_netif] initializing netdev_tap #%u on TAP %s\n", + i, *(p->tap_name)); + + netdev_tap_setup(&netdev_tap[i], p); + gnrc_netdev_eth_init(&_gnrc_netdev_tap[i], (netdev_t*)&netdev_tap[i]); + + gnrc_netdev_init(_netdev_eth_stack[i], TAP_MAC_STACKSIZE, + TAP_MAC_PRIO, "gnrc_netdev_tap", + &_gnrc_netdev_tap[i]); + } +} + +#else +typedef int dont_be_pedantic; +#endif /* MODULE_NETDEV_TAP */ +/** @} */ diff --git a/sys/auto_init/netif/auto_init_slip.c b/sys/auto_init/netif/auto_init_slip.c index ad0a498137..51f704ccae 100644 --- a/sys/auto_init/netif/auto_init_slip.c +++ b/sys/auto_init/netif/auto_init_slip.c @@ -21,7 +21,7 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netdev2.h" +#include "net/gnrc/netdev.h" #include "net/gnrc.h" #include "net/gnrc/slip.h" @@ -37,7 +37,7 @@ static gnrc_slip_dev_t slip_devs[SLIP_NUM]; */ #define SLIP_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef SLIP_PRIO -#define SLIP_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define SLIP_PRIO (GNRC_NETDEV_MAC_PRIO) #endif /** diff --git a/sys/auto_init/netif/auto_init_w5100.c b/sys/auto_init/netif/auto_init_w5100.c index cd4074226f..c5131393a4 100644 --- a/sys/auto_init/netif/auto_init_w5100.c +++ b/sys/auto_init/netif/auto_init_w5100.c @@ -22,8 +22,8 @@ #include "log.h" #include "w5100.h" #include "w5100_params.h" -#include "net/gnrc/netdev2.h" -#include "net/gnrc/netdev2/eth.h" +#include "net/gnrc/netdev.h" +#include "net/gnrc/netdev/eth.h" /** * @brief Define stack parameters for the MAC layer thread @@ -43,7 +43,7 @@ * @{ */ static w5100_t dev[W5100_NUM]; -static gnrc_netdev2_t gnrc_adpt[W5100_NUM]; +static gnrc_netdev_t gnrc_adpt[W5100_NUM]; /** @} */ /** @@ -57,13 +57,13 @@ void auto_init_w5100(void) for (unsigned i = 0; i < W5100_NUM; i++) { LOG_DEBUG("[auto_init_netif] initializing w5100 #%u\n", i); - /* setup netdev2 device */ + /* setup netdev device */ w5100_setup(&dev[i], &w5100_params[i]); - /* initialize netdev2 <-> gnrc adapter state */ - gnrc_netdev2_eth_init(&gnrc_adpt[i], (netdev2_t *)&dev[i]); - /* start gnrc netdev2 thread */ - gnrc_netdev2_init(stack[i], MAC_STACKSIZE, MAC_PRIO, - "gnrc_w5100", &gnrc_adpt[i]); + /* initialize netdev <-> gnrc adapter state */ + gnrc_netdev_eth_init(&gnrc_adpt[i], (netdev_t *)&dev[i]); + /* start gnrc netdev thread */ + gnrc_netdev_init(stack[i], MAC_STACKSIZE, MAC_PRIO, + "gnrc_w5100", &gnrc_adpt[i]); } } diff --git a/sys/auto_init/netif/auto_init_xbee.c b/sys/auto_init/netif/auto_init_xbee.c index 73a859330d..f3e8b2e10a 100644 --- a/sys/auto_init/netif/auto_init_xbee.c +++ b/sys/auto_init/netif/auto_init_xbee.c @@ -23,7 +23,7 @@ #include "log.h" #include "board.h" -#include "net/gnrc/netdev2/xbee_adpt.h" +#include "net/gnrc/netdev/xbee_adpt.h" #include "xbee_params.h" /** @@ -36,14 +36,14 @@ */ #define XBEE_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #ifndef XBEE_MAC_PRIO -#define XBEE_MAC_PRIO (GNRC_NETDEV2_MAC_PRIO) +#define XBEE_MAC_PRIO (GNRC_NETDEV_MAC_PRIO) #endif /** * @brief Allocate memory for device descriptors, stacks, and GNRC adaption */ static xbee_t xbee_devs[XBEE_NUM]; -static gnrc_netdev2_t gnrc_adpt[XBEE_NUM]; +static gnrc_netdev_t gnrc_adpt[XBEE_NUM]; static char stacks[XBEE_NUM][XBEE_MAC_STACKSIZE]; void auto_init_xbee(void) @@ -52,8 +52,8 @@ void auto_init_xbee(void) LOG_DEBUG("[auto_init_netif] initializing xbee #%u\n", i); xbee_setup(&xbee_devs[i], &xbee_params[i]); - gnrc_netdev2_xbee_init(&gnrc_adpt[i], &xbee_devs[i]); - gnrc_netdev2_init(stacks[i], XBEE_MAC_STACKSIZE, XBEE_MAC_PRIO, + gnrc_netdev_xbee_init(&gnrc_adpt[i], &xbee_devs[i]); + gnrc_netdev_init(stacks[i], XBEE_MAC_STACKSIZE, XBEE_MAC_PRIO, "xbee", &gnrc_adpt[i]); } } diff --git a/sys/include/net/csma_sender.h b/sys/include/net/csma_sender.h index 981bcb71b5..17ef5747ad 100644 --- a/sys/include/net/csma_sender.h +++ b/sys/include/net/csma_sender.h @@ -27,7 +27,7 @@ #include -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus @@ -101,7 +101,7 @@ extern const csma_sender_conf_t CSMA_SENDER_CONF_DEFAULT; * @return -EBUSY if radio medium never was available * to send the given data */ -int csma_sender_csma_ca_send(netdev2_t *dev, struct iovec *vector, +int csma_sender_csma_ca_send(netdev_t *dev, struct iovec *vector, unsigned count, const csma_sender_conf_t *conf); /** @@ -133,7 +133,7 @@ int csma_sender_csma_ca_send(netdev2_t *dev, struct iovec *vector, * @return -EBUSY if radio medium was not available * to send the given data */ -int csma_sender_cca_send(netdev2_t *dev, struct iovec *vector, unsigned count); +int csma_sender_cca_send(netdev_t *dev, struct iovec *vector, unsigned count); #ifdef __cplusplus diff --git a/sys/include/net/gnrc.h b/sys/include/net/gnrc.h index 5ac5328bd1..e35ec045bd 100644 --- a/sys/include/net/gnrc.h +++ b/sys/include/net/gnrc.h @@ -18,7 +18,7 @@ * ===== * * This module is currently the default network stack for RIOT and includes - * many components ranging from a @ref net_gnrc_netdev2 through a fully-featured + * many components ranging from a @ref net_gnrc_netdev through a fully-featured * @ref net_gnrc_ipv6 implementation with @ref net_gnrc_sixlowpan "6LowPAN" * extensions to an @ref net_gnrc_udp "UDP" implementation and * @ref net_gnrc_rpl. @@ -30,8 +30,8 @@ * ===================== * * From the application layer the @ref net_gnrc can be accessed through the - * @ref net_sock, while the interface to the @ref drivers_netdev_netdev2 is - * defined by the @ref net_gnrc_netdev2. + * @ref net_sock, while the interface to the @ref drivers_netdev_api is + * defined by the @ref net_gnrc_netdev. * * Architecture * ============ @@ -284,7 +284,6 @@ #define GNRC_NETBASE_H #include "net/netopt.h" -#include "net/gnrc/netdev.h" #include "net/gnrc/netapi.h" #include "net/gnrc/netreg.h" #include "net/gnrc/nettype.h" diff --git a/sys/include/net/gnrc/mac/internal.h b/sys/include/net/gnrc/mac/internal.h index 19300ad265..912e9abc99 100644 --- a/sys/include/net/gnrc/mac/internal.h +++ b/sys/include/net/gnrc/mac/internal.h @@ -31,15 +31,15 @@ extern "C" { #if (GNRC_MAC_TX_QUEUE_SIZE != 0) || defined(DOXYGEN) /** - * @brief Queues the packet into the related transmission packet queue in netdev2_t::tx. + * @brief Queues the packet into the related transmission packet queue in netdev_t::tx. * Note that, in case the `gnrc_mac_tx_neighbor_t` structure is in used (indicated * by `GNRC_MAC_NEIGHBOR_COUNT != 0`), this function queues the packet to * the queue associated to the pkt's destination neighbor, including a - * `broadcast-neighbor` (neighbor id is `0` in netdev2_t::tx::neighbors) which + * `broadcast-neighbor` (neighbor id is `0` in netdev_t::tx::neighbors) which * specifically stores broadcasting packets. * On the other hand, if `gnrc_mac_tx_neighbor_t` structure is not in used (indicated * by `GNRC_MAC_NEIGHBOR_COUNT == 0`), this function queues the packet into the single - * priority TX queue defined in in netdev2_t::tx. + * priority TX queue defined in in netdev_t::tx. * * @param[in,out] tx gnrc_mac transmission management object * @param[in] priority the priority of @p pkt @@ -52,7 +52,7 @@ bool gnrc_mac_queue_tx_packet(gnrc_mac_tx_t* tx, uint32_t priority, gnrc_pktsnip #if (GNRC_MAC_RX_QUEUE_SIZE != 0) || defined(DOXYGEN) /** - * @brief Queues the packet into the reception packet queue in netdev2_t::rx. + * @brief Queues the packet into the reception packet queue in netdev_t::rx. * * @param[in,out] rx gnrc_mac reception management object * @param[in] priority the priority of @p pkt @@ -65,7 +65,7 @@ bool gnrc_mac_queue_rx_packet(gnrc_mac_rx_t* rx, uint32_t priority, gnrc_pktsnip #if (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0) || defined(DOXYGEN) /** - * @brief Dispatch all the packets stored in netdev2_t::rx:dispatch_buffer to upper layer. + * @brief Dispatch all the packets stored in netdev_t::rx:dispatch_buffer to upper layer. * * @param[in,out] rx gnrc_mac reception management object */ diff --git a/sys/include/net/gnrc/netdev.h b/sys/include/net/gnrc/netdev.h index fb8aac313f..b7d6d480c1 100644 --- a/sys/include/net/gnrc/netdev.h +++ b/sys/include/net/gnrc/netdev.h @@ -1,6 +1,5 @@ /* - * Copyright (C) 2014 Martine Lenders - * Copyright (C) 2015 Freie Universität Berlin + * Copyright (C) 2015 Kaspar Schleiser * * 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 @@ -8,182 +7,216 @@ */ /** - * @defgroup net_gnrc_netdev Network device driver interface - * @ingroup net_gnrc - * @deprecated Use @ref drivers_netdev_netdev2 "netdev2" instead for new - * devices. This module only allows for interaction with - * @ref net_gnrc "GNRC", while @ref drivers_netdev_netdev2 - * "netdev2" is independent from the stack. - * @brief Common network device interface + * @defgroup net_gnrc_netdev Adaption layer for GNRC on top of Netdev + * @ingroup net_gnrc + * @brief Provides the glue code for @ref net_gnrc on top of @ref drivers_netdev_api * @{ * * @file - * @brief Network device driver interface definition. + * @brief netdev-GNRC glue code interface * - * @author Martine Lenders - * @author Hauke Petersen + * This interface is supposed to provide common adaption code between the + * low-level network device interface "netdev" and the GNRC network stack. + * + * GNRC sends around "gnrc_pktsnip_t" structures, but netdev can only handle + * "struct iovec" structures when sending, or a flat buffer when receiving. + * + * The purpose of gnrc_netdev is to bring these two interfaces together. + * + * @author Kaspar Schleiser */ #ifndef GNRC_NETDEV_H #define GNRC_NETDEV_H -#include +#include #include -#include -#include "net/gnrc/pkt.h" -#include "net/netopt.h" +#include "kernel_types.h" +#include "net/netdev.h" +#include "net/gnrc.h" +#include "net/gnrc/mac/types.h" +#include "net/ieee802154.h" +#include "net/gnrc/mac/mac.h" #ifdef __cplusplus extern "C" { #endif +/** + * @brief Default priority for adaption layer's threads + */ +#ifndef GNRC_NETDEV_MAC_PRIO +#define GNRC_NETDEV_MAC_PRIO (THREAD_PRIORITY_MAIN - 5) +#endif + /** * @brief Type for @ref msg_t if device fired an event */ -#define GNRC_NETDEV_MSG_TYPE_EVENT (0x0100) +#define NETDEV_MSG_TYPE_EVENT 0x1234 /** - * @brief Possible event types that are send from the device driver to the - * MAC layer + * @brief Mask for @ref gnrc_mac_tx_feedback_t */ -typedef enum { - NETDEV_EVENT_RX_STARTED = 0x0001, /**< started to receive a packet */ - NETDEV_EVENT_RX_COMPLETE = 0x0002, /**< finished receiving a packet */ - NETDEV_EVENT_TX_STARTED = 0x0004, /**< started to transfer a packet */ - NETDEV_EVENT_TX_COMPLETE = 0x0008, /**< finished transferring packet */ - NETDEV_EVENT_TX_NOACK = 0x0010, /**< ACK requested but not received */ - NETDEV_EVENT_TX_MEDIUM_BUSY = 0x0020, /**< couldn't transfer packet */ - /* expand this list if needed */ -} gnrc_netdev_event_t; +#define GNRC_NETDEV_MAC_INFO_TX_FEEDBACK_MASK (0x0003U) /** - * @brief Event callback for signaling event to a MAC layer - * - * @param[in] type type of the event - * @param[in] arg event argument, can e.g. contain a pktsnip_t pointer + * @brief Flag to track if a transmission might have corrupted a received + * packet */ -typedef void (*gnrc_netdev_event_cb_t)(gnrc_netdev_event_t type, void *arg); +#define GNRC_NETDEV_MAC_INFO_RX_STARTED (0x0004U) /** - * @brief Forward declaration of gnrc_netdev_t due to cyclic dependency to - * @ref gnrc_netdev_driver_t. + * @brief Structure holding GNRC netdev adapter state * - * @see gnrc_netdev + * This structure is supposed to hold any state parameters needed + * to use a netdev device from GNRC. + * + * It can be extended */ -typedef struct gnrc_netdev gnrc_netdev_t; +typedef struct gnrc_netdev { + /** + * @brief Send a pktsnip using this device + * + * This function should convert the pktsnip into a format + * the underlying device understands and send it. + */ + int (*send)(struct gnrc_netdev *dev, gnrc_pktsnip_t *snip); + + /** + * @brief Receive a pktsnip from this device + * + * This function should receive a raw frame from the underlying + * device and convert it into a pktsnip while adding a netif header + * and possibly marking out higher-layer headers. + */ + gnrc_pktsnip_t * (*recv)(struct gnrc_netdev *dev); + + /** + * @brief netdev handle this adapter is working with + */ + netdev_t *dev; + + /** + * @brief PID of this adapter for netapi messages + */ + kernel_pid_t pid; + +#ifdef MODULE_GNRC_MAC + /** + * @brief general information for the MAC protocol + */ + uint16_t mac_info; + + /** + * @brief device's l2 address + */ + uint8_t l2_addr[IEEE802154_LONG_ADDRESS_LEN]; + + /** + * @brief device's l2 address length + */ + uint8_t l2_addr_len; + +#if ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN) + /** + * @brief MAC internal object which stores reception parameters, queues, and + * state machines. + */ + gnrc_mac_rx_t rx; +#endif /* ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN) */ + +#if ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (GNRC_MAC_NEIGHBOR_COUNT != 0)) || defined(DOXYGEN) + /** + * @brief MAC internal object which stores transmission parameters, queues, and + * state machines. + */ + gnrc_mac_tx_t tx; +#endif /* ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (GNRC_MAC_NEIGHBOR_COUNT == 0)) || defined(DOXYGEN) */ +#endif /* MODULE_GNRC_MAC */ +} gnrc_netdev_t; + +#ifdef MODULE_GNRC_MAC /** - * @brief Network device API definition. + * @brief get the 'rx_started' state of the device * - * @details This is a set of functions that must be implemented by any driver - * for a network device. + * This function checks whether the device has started receiving a packet. + * + * @param[in] dev ptr to netdev device + * + * @return the rx_started state */ -typedef struct { - /** - * @brief Send data via a given network device - * - * @param[in] dev network device descriptor - * @param[in] pkt pointer to the data in the packet buffer - * - * @return number of bytes that were actually send out - * @return -ENODEV if @p dev is invalid - * @return -ENOMSG if pkt is invalid - * @return -EOVERFLOW if the payload size of @p pkt exceeds the - * payload size that can be handled by the device - */ - int (*send_data)(gnrc_netdev_t *dev, gnrc_pktsnip_t *pkt); - - /** - * @brief Registers an event callback to a given network device - * - * @param[in] dev network device descriptor - * @param[in] cb function that is called on events - * - * @return 0 on success - * @return -ENODEV if @p dev is invalid - * @return -ENOBUFS if maximum number of callbacks is exceeded - */ - int (*add_event_callback)(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb); - - /** - * @brief Unregisters an event callback from a given network device - * - * @param[in] dev network device descriptor - * @param[in] cb callback function - * - * @return 0 on success - * @return -ENODEV if @p dev is invalid - * @return -ENOENT if callback was not registered - */ - int (*rem_event_callback)(gnrc_netdev_t *dev, gnrc_netdev_event_cb_t cb); - - /** - * @brief Get an option value from a given network device - * - * @note This function does not check for proper alignment of the memory - * region accessed. It is the responsibility of the caller to - * assure aligned memory access. - * - * @param[in] dev network device descriptor - * @param[in] opt option type - * @param[out] value pointer to store the option's value in - * @param[in] max_len maximal amount of byte that fit into @p value - * - * @return number of bytes written to @p value - * @return -ENODEV if @p dev is invalid - * @return -ENOTSUP if @p opt is not supported - * @return -EOVERFLOW if available space in @p value given in - * @p max_len is too small to store the option value - * @return -ECANCELED if internal driver error occurred - */ - int (*get)(gnrc_netdev_t *dev, netopt_t opt, void *value, size_t max_len); - - /** - * @brief Set an option value for a given network device - * - * @note This function does not check for proper alignment of the memory - * region accessed. It is the responsibility of the caller to - * assure aligned memory access. - * - * @param[in] dev network device descriptor - * @param[in] opt option type - * @param[in] value value to set - * @param[in] value_len the length of @p value - * - * @return number of bytes used from @p value - * @return -ENODEV if @p dev is invalid - * @return -ENOTSUP if @p opt is not supported - * @return -EINVAL if @p value is invalid - * @return -ECANCELED if internal driver error occurred - */ - int (*set)(gnrc_netdev_t *dev, netopt_t opt, void *value, size_t value_len); - - /** - * @brief This function is called by a MAC layer when a message of type - * @ref GNRC_NETDEV_MSG_TYPE_EVENT was received - * - * @param[in] dev network device descriptor - * @param[in] event_type event type, given by msg_t::content::value - * in the received message - */ - void (*isr_event)(gnrc_netdev_t *dev, uint32_t event_type); -} gnrc_netdev_driver_t; +static inline bool gnrc_netdev_get_rx_started(gnrc_netdev_t *dev) +{ + return (dev->mac_info & GNRC_NETDEV_MAC_INFO_RX_STARTED); +} /** - * @brief The netdev data-structure holds the minimum information needed for - * interaction with MAC layers and can be expanded with device - * specific fields + * @brief set the rx_started state of the device * - * The netdev structure is the parent for all network device driver descriptors. + * This function is intended to be called only in netdev_t::event_callback(). + * + * @param[in] dev ptr to netdev device * - * @see gnrc_netdev_t */ -struct gnrc_netdev { - 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 */ -}; +static inline void gnrc_netdev_set_rx_started(gnrc_netdev_t *dev, bool rx_started) +{ + if (rx_started) { + dev->mac_info |= GNRC_NETDEV_MAC_INFO_RX_STARTED; + } + else { + dev->mac_info &= ~GNRC_NETDEV_MAC_INFO_RX_STARTED; + } +} + +/** + * @brief get the transmission feedback of the device + * + * @param[in] dev ptr to netdev device + * + * @return the transmission feedback + */ +static inline gnrc_mac_tx_feedback_t gnrc_netdev_get_tx_feedback(gnrc_netdev_t *dev) +{ + return (gnrc_mac_tx_feedback_t)(dev->mac_info & + GNRC_NETDEV_MAC_INFO_TX_FEEDBACK_MASK); +} + +/** + * @brief set the transmission feedback of the device + * + * This function is intended to be called only in netdev_t::event_callback(). + * + * @param[in] dev ptr to netdev device + * + */ +static inline void gnrc_netdev_set_tx_feedback(gnrc_netdev_t *dev, + gnrc_mac_tx_feedback_t txf) +{ + /* check if gnrc_mac_tx_feedback does not collide with + * GNRC_NETDEV_MAC_INFO_RX_STARTED */ + assert(!(txf & GNRC_NETDEV_MAC_INFO_RX_STARTED)); + /* unset previous value */ + dev->mac_info &= ~GNRC_NETDEV_MAC_INFO_TX_FEEDBACK_MASK; + dev->mac_info |= (uint16_t)(txf & GNRC_NETDEV_MAC_INFO_TX_FEEDBACK_MASK); +} +#endif + +/** + * @brief Initialize GNRC netdev handler thread + * + * @param[in] stack ptr to preallocated stack buffer + * @param[in] stacksize size of stack buffer + * @param[in] priority priority of thread + * @param[in] name name of thread + * @param[in] gnrc_netdev ptr to netdev device to handle in created thread + * + * @return pid of created thread + * @return KERNEL_PID_UNDEF on error + */ +kernel_pid_t gnrc_netdev_init(char *stack, int stacksize, char priority, + const char *name, gnrc_netdev_t *gnrc_netdev); #ifdef __cplusplus } diff --git a/sys/include/net/gnrc/netdev2/eth.h b/sys/include/net/gnrc/netdev/eth.h similarity index 50% rename from sys/include/net/gnrc/netdev2/eth.h rename to sys/include/net/gnrc/netdev/eth.h index 62bb9a2062..fafb366695 100644 --- a/sys/include/net/gnrc/netdev2/eth.h +++ b/sys/include/net/gnrc/netdev/eth.h @@ -7,38 +7,38 @@ */ /** - * @ingroup net_gnrc_netdev2 + * @ingroup net_gnrc_netdev * @{ * * @file - * @brief netdev2 gnrc ethernet glue code interface + * @brief netdev gnrc ethernet glue code interface * * @author Kaspar Schleiser */ -#ifndef GNRC_NETDEV2_ETH_H -#define GNRC_NETDEV2_ETH_H +#ifndef GNRC_NETDEV_ETH_H +#define GNRC_NETDEV_ETH_H -#include "net/gnrc/netdev2.h" +#include "net/gnrc/netdev.h" #ifdef __cplusplus extern "C" { #endif /** - * @brief Initialize gnrc handler thread for netdev2 ethernet device + * @brief Initialize gnrc handler thread for netdev ethernet device * - * @param[in] gnrc_netdev2 gnrc_netdev2 struct to initialize - * @param[in] dev netdev2 device to handle + * @param[in] gnrc_netdev gnrc_netdev struct to initialize + * @param[in] dev netdev device to handle * * @return 1 on success * @return <=0 on error */ -int gnrc_netdev2_eth_init(gnrc_netdev2_t *gnrc_netdev2, netdev2_t *dev); +int gnrc_netdev_eth_init(gnrc_netdev_t *gnrc_netdev, netdev_t *dev); #ifdef __cplusplus } #endif -#endif /* GNRC_NETDEV2_ETH_H */ +#endif /* GNRC_NETDEV_ETH_H */ /** @} */ diff --git a/sys/include/net/gnrc/netdev/ieee802154.h b/sys/include/net/gnrc/netdev/ieee802154.h new file mode 100644 index 0000000000..48cb8b0d8c --- /dev/null +++ b/sys/include/net/gnrc/netdev/ieee802154.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2016 Freie Universität Berlin + * + * 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. + */ + +/** + * @ingroup net_gnrc_netdev + * @brief + * @{ + * + * @file + * @brief netdev gnrc IEEE 802.15.4 glue code interface + * + * @author Martine Lenders + */ +#ifndef GNRC_NETDEV_IEEE802154_H +#define GNRC_NETDEV_IEEE802154_H + +#include "net/netdev/ieee802154.h" +#include "net/gnrc/netdev.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize gnrc handler for netdev IEEE 802.15.4 device + * + * @param[in] gnrc_netdev gnrc_netdev struct to initialize + * @param[in] dev netdev device to handle + * + * @return 1 on success + * @return <=0 on error + */ +int gnrc_netdev_ieee802154_init(gnrc_netdev_t *gnrc_netdev, + netdev_ieee802154_t *dev); + +#ifdef __cplusplus +} +#endif + +#endif /* GNRC_IEEE802154_H */ +/** @} */ diff --git a/sys/include/net/gnrc/netdev2/xbee_adpt.h b/sys/include/net/gnrc/netdev/xbee_adpt.h similarity index 70% rename from sys/include/net/gnrc/netdev2/xbee_adpt.h rename to sys/include/net/gnrc/netdev/xbee_adpt.h index 73980e5c2e..11da5dee8a 100644 --- a/sys/include/net/gnrc/netdev2/xbee_adpt.h +++ b/sys/include/net/gnrc/netdev/xbee_adpt.h @@ -7,11 +7,11 @@ */ /** - * @ingroup net_gnrc_netdev2 + * @ingroup net_gnrc_netdev * @{ * * @file - * @brief GNRC to XBee netdev2 glue code interface + * @brief GNRC to XBee netdev glue code interface * * Although the XBee devices are IEEE802.15.4 transceivers, use their own * proprietary format for communicating between the host CPU and the device over @@ -25,11 +25,11 @@ * @author Hauke Petersen */ -#ifndef GNRC_NETDEV2_XBEE_ADPT_H -#define GNRC_NETDEV2_XBEE_ADPT_H +#ifndef GNRC_NETDEV_XBEE_ADPT_H +#define GNRC_NETDEV_XBEE_ADPT_H #include "xbee.h" -#include "net/gnrc/netdev2.h" +#include "net/gnrc/netdev.h" #ifdef __cplusplus @@ -37,16 +37,16 @@ extern "C" { #endif /** - * @brief Initialize GNRC handler for netdev2 XBee devices + * @brief Initialize GNRC handler for netdev XBee devices * - * @param[out] gnrc_netdev2 gnrc_netdev2 struct to initialize + * @param[out] gnrc_netdev gnrc_netdev struct to initialize * @param[in] dev XBee device to handle */ -void gnrc_netdev2_xbee_init(gnrc_netdev2_t *gnrc_netdev2, xbee_t *dev); +void gnrc_netdev_xbee_init(gnrc_netdev_t *gnrc_netdev, xbee_t *dev); #ifdef __cplusplus } #endif -#endif /* GNRC_NETDEV2_XBEE_ADPT_H */ +#endif /* GNRC_NETDEV_XBEE_ADPT_H */ /** @} */ diff --git a/sys/include/net/gnrc/netdev2.h b/sys/include/net/gnrc/netdev2.h deleted file mode 100644 index 916c4ed771..0000000000 --- a/sys/include/net/gnrc/netdev2.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 2015 Kaspar Schleiser - * - * 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 net_gnrc_netdev2 Adaption layer for GNRC on top of Netdev2 - * @ingroup net_gnrc - * @brief Provides the glue code for @ref net_gnrc on top of @ref drivers_netdev_netdev2 - * @{ - * - * @file - * @brief netdev2-GNRC glue code interface - * - * This interface is supposed to provide common adaption code between the - * low-level network device interface "netdev2" and the GNRC network stack. - * - * GNRC sends around "gnrc_pktsnip_t" structures, but netdev can only handle - * "struct iovec" structures when sending, or a flat buffer when receiving. - * - * The purpose of gnrc_netdev is to bring these two interfaces together. - * - * @author Kaspar Schleiser - */ - -#ifndef GNRC_NETDEV2_H -#define GNRC_NETDEV2_H - -#include -#include - -#include "kernel_types.h" -#include "net/netdev2.h" -#include "net/gnrc.h" -#include "net/gnrc/mac/types.h" -#include "net/ieee802154.h" -#include "net/gnrc/mac/mac.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Default priority for adaption layer's threads - */ -#ifndef GNRC_NETDEV2_MAC_PRIO -#define GNRC_NETDEV2_MAC_PRIO (THREAD_PRIORITY_MAIN - 5) -#endif - -/** - * @brief Type for @ref msg_t if device fired an event - */ -#define NETDEV2_MSG_TYPE_EVENT 0x1234 - -/** - * @brief Mask for @ref gnrc_mac_tx_feedback_t - */ -#define GNRC_NETDEV2_MAC_INFO_TX_FEEDBACK_MASK (0x0003U) - -/** - * @brief Flag to track if a transmission might have corrupted a received - * packet - */ -#define GNRC_NETDEV2_MAC_INFO_RX_STARTED (0x0004U) - -/** - * @brief Structure holding GNRC netdev2 adapter state - * - * This structure is supposed to hold any state parameters needed - * to use a netdev2 device from GNRC. - * - * It can be extended - */ -typedef struct gnrc_netdev2 { - /** - * @brief Send a pktsnip using this device - * - * This function should convert the pktsnip into a format - * the underlying device understands and send it. - */ - int (*send)(struct gnrc_netdev2 *dev, gnrc_pktsnip_t *snip); - - /** - * @brief Receive a pktsnip from this device - * - * This function should receive a raw frame from the underlying - * device and convert it into a pktsnip while adding a netif header - * and possibly marking out higher-layer headers. - */ - gnrc_pktsnip_t * (*recv)(struct gnrc_netdev2 *dev); - - /** - * @brief netdev2 handle this adapter is working with - */ - netdev2_t *dev; - - /** - * @brief PID of this adapter for netapi messages - */ - kernel_pid_t pid; - -#ifdef MODULE_GNRC_MAC - /** - * @brief general information for the MAC protocol - */ - uint16_t mac_info; - - /** - * @brief device's l2 address - */ - uint8_t l2_addr[IEEE802154_LONG_ADDRESS_LEN]; - - /** - * @brief device's l2 address length - */ - uint8_t l2_addr_len; - -#if ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN) - /** - * @brief MAC internal object which stores reception parameters, queues, and - * state machines. - */ - gnrc_mac_rx_t rx; -#endif /* ((GNRC_MAC_RX_QUEUE_SIZE != 0) || (GNRC_MAC_DISPATCH_BUFFER_SIZE != 0)) || defined(DOXYGEN) */ - -#if ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (GNRC_MAC_NEIGHBOR_COUNT != 0)) || defined(DOXYGEN) - /** - * @brief MAC internal object which stores transmission parameters, queues, and - * state machines. - */ - gnrc_mac_tx_t tx; -#endif /* ((GNRC_MAC_TX_QUEUE_SIZE != 0) || (GNRC_MAC_NEIGHBOR_COUNT == 0)) || defined(DOXYGEN) */ -#endif /* MODULE_GNRC_MAC */ -} gnrc_netdev2_t; - -#ifdef MODULE_GNRC_MAC - -/** - * @brief get the 'rx_started' state of the device - * - * This function checks whether the device has started receiving a packet. - * - * @param[in] dev ptr to netdev2 device - * - * @return the rx_started state - */ -static inline bool gnrc_netdev2_get_rx_started(gnrc_netdev2_t *dev) -{ - return (dev->mac_info & GNRC_NETDEV2_MAC_INFO_RX_STARTED); -} - -/** - * @brief set the rx_started state of the device - * - * This function is intended to be called only in netdev2_t::event_callback(). - * - * @param[in] dev ptr to netdev2 device - * - */ -static inline void gnrc_netdev2_set_rx_started(gnrc_netdev2_t *dev, bool rx_started) -{ - if (rx_started) { - dev->mac_info |= GNRC_NETDEV2_MAC_INFO_RX_STARTED; - } - else { - dev->mac_info &= ~GNRC_NETDEV2_MAC_INFO_RX_STARTED; - } -} - -/** - * @brief get the transmission feedback of the device - * - * @param[in] dev ptr to netdev2 device - * - * @return the transmission feedback - */ -static inline gnrc_mac_tx_feedback_t gnrc_netdev2_get_tx_feedback(gnrc_netdev2_t *dev) -{ - return (gnrc_mac_tx_feedback_t)(dev->mac_info & - GNRC_NETDEV2_MAC_INFO_TX_FEEDBACK_MASK); -} - -/** - * @brief set the transmission feedback of the device - * - * This function is intended to be called only in netdev2_t::event_callback(). - * - * @param[in] dev ptr to netdev2 device - * - */ -static inline void gnrc_netdev2_set_tx_feedback(gnrc_netdev2_t *dev, - gnrc_mac_tx_feedback_t txf) -{ - /* check if gnrc_mac_tx_feedback does not collide with - * GNRC_NETDEV2_MAC_INFO_RX_STARTED */ - assert(!(txf & GNRC_NETDEV2_MAC_INFO_RX_STARTED)); - /* unset previous value */ - dev->mac_info &= ~GNRC_NETDEV2_MAC_INFO_TX_FEEDBACK_MASK; - dev->mac_info |= (uint16_t)(txf & GNRC_NETDEV2_MAC_INFO_TX_FEEDBACK_MASK); -} -#endif - -/** - * @brief Initialize GNRC netdev2 handler thread - * - * @param[in] stack ptr to preallocated stack buffer - * @param[in] stacksize size of stack buffer - * @param[in] priority priority of thread - * @param[in] name name of thread - * @param[in] gnrc_netdev2 ptr to netdev2 device to handle in created thread - * - * @return pid of created thread - * @return KERNEL_PID_UNDEF on error - */ -kernel_pid_t gnrc_netdev2_init(char *stack, int stacksize, char priority, - const char *name, gnrc_netdev2_t *gnrc_netdev2); - -#ifdef __cplusplus -} -#endif - -#endif /* GNRC_NETDEV2_H */ -/** @} */ diff --git a/sys/include/net/gnrc/netdev2/ieee802154.h b/sys/include/net/gnrc/netdev2/ieee802154.h deleted file mode 100644 index cb97034d83..0000000000 --- a/sys/include/net/gnrc/netdev2/ieee802154.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2016 Freie Universität Berlin - * - * 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. - */ - -/** - * @ingroup net_gnrc_netdev2 - * @brief - * @{ - * - * @file - * @brief netdev2 gnrc IEEE 802.15.4 glue code interface - * - * @author Martine Lenders - */ -#ifndef GNRC_NETDEV2_IEEE802154_H -#define GNRC_NETDEV2_IEEE802154_H - -#include "net/netdev2/ieee802154.h" -#include "net/gnrc/netdev2.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Initialize gnrc handler for netdev2 IEEE 802.15.4 device - * - * @param[in] gnrc_netdev2 gnrc_netdev2 struct to initialize - * @param[in] dev netdev2 device to handle - * - * @return 1 on success - * @return <=0 on error - */ -int gnrc_netdev2_ieee802154_init(gnrc_netdev2_t *gnrc_netdev2, - netdev2_ieee802154_t *dev); - -#ifdef __cplusplus -} -#endif - -#endif /* GNRC_IEEE802154_H */ -/** @} */ diff --git a/sys/include/net/netdev2_test.h b/sys/include/net/netdev_test.h similarity index 61% rename from sys/include/net/netdev2_test.h rename to sys/include/net/netdev_test.h index a01cea7589..22cf35cd1f 100644 --- a/sys/include/net/netdev2_test.h +++ b/sys/include/net/netdev_test.h @@ -7,9 +7,9 @@ */ /** - * @defgroup sys_netdev2_test netdev2 dummy test driver + * @defgroup sys_netdev_test netdev dummy test driver * @ingroup drivers_netdev - * @brief Provides a test dummy for the netdev2 interface. + * @brief Provides a test dummy for the netdev interface. * * See the following simple packet traversal timer for an example. Note that * this example assumes that the stack doesn't require any option values from @@ -23,17 +23,17 @@ * #include "net/af.h" * #include "net/conn/udp.h" * #include "net/ipv6/addr.h" - * #include "net/netdev2_test.h" + * #include "net/netdev_test.h" * #include "xtimer.h" * * #define PKT_NUMBER (1000) * - * static netdev2_test_t dev; + * static netdev_test_t dev; * static uint32_t last_start; * static uint32_t sum = 0; * static mutex_t wait = MUTEX_INIT; * - * int _send_timer(netdev2_t *dev, const struct iovec *vector, int count) + * int _send_timer(netdev_t *dev, const struct iovec *vector, int count) * { * (void)dev; * (void)vector; @@ -46,8 +46,8 @@ * int main(void) { * ipv6_addr_t dst = IPV6_ADDR_UNSPECIFIED; * - * netdev2_test_setup(&dev, NULL); - * dev->driver->init((netdev2_t *)&dev) + * netdev_test_setup(&dev, NULL); + * dev->driver->init((netdev_t *)&dev) * // initialize stack and connect `dev` to it * // ... * mutex_lock(&wait); @@ -64,7 +64,7 @@ * ~~~~~~~~~~~ * * To provide options to the stack, the - * @ref netdev2_test_t::get_cbs "get callbacks" for the specific options need + * @ref netdev_test_t::get_cbs "get callbacks" for the specific options need * to be set. * To catch lost packets and additional sent by the stack the send handler needs * to be adapted accordingly. @@ -72,20 +72,20 @@ * @{ * * @file - * @brief @ref sys_netdev2_test definitions + * @brief @ref sys_netdev_test definitions * * @author Martine Lenders */ -#ifndef NETDEV2_TEST_H -#define NETDEV2_TEST_H +#ifndef NETDEV_TEST_H +#define NETDEV_TEST_H #include "mutex.h" -#ifdef MODULE_NETDEV2_IEEE802154 -#include "net/netdev2/ieee802154.h" +#ifdef MODULE_NETDEV_IEEE802154 +#include "net/netdev/ieee802154.h" #endif -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -101,9 +101,9 @@ extern "C" { * @return number of bytes sent * @return <= 0 on error */ -typedef int (*netdev2_test_send_cb_t)(netdev2_t *dev, - const struct iovec *vector, - int count); +typedef int (*netdev_test_send_cb_t)(netdev_t *dev, + const struct iovec *vector, + int count); /** * @brief Callback type to handle receive command @@ -112,15 +112,15 @@ typedef int (*netdev2_test_send_cb_t)(netdev2_t *dev, * @param[out] buf buffer to write into or `NULL` * @param[in] len maximum number of bytes to read * @param[out] info status information for the received packet. Might - * be of different type for different netdev2 devices. + * be of different type for different netdev devices. * May be NULL if not needed or applicable * * @return <=0 on error * @return number of bytes read if buf != NULL * @return currently received packet size if buf == NULL */ -typedef int (*netdev2_test_recv_cb_t)(netdev2_t *dev, char *buf, int len, - void *info); +typedef int (*netdev_test_recv_cb_t)(netdev_t *dev, char *buf, int len, + void *info); /** * @brief Callback type to handle device initialization @@ -130,14 +130,14 @@ typedef int (*netdev2_test_recv_cb_t)(netdev2_t *dev, char *buf, int len, * @return <= on error * @return 0 on success */ -typedef int (*netdev2_test_init_cb_t)(netdev2_t *dev); +typedef int (*netdev_test_init_cb_t)(netdev_t *dev); /** * @brief Callback type to handle user-space ISR events * * @param[in] dev network device descriptor */ -typedef void (*netdev2_test_isr_cb_t)(netdev2_t *dev); +typedef void (*netdev_test_isr_cb_t)(netdev_t *dev); /** * @brief Callback type to handle get commands @@ -149,8 +149,8 @@ typedef void (*netdev2_test_isr_cb_t)(netdev2_t *dev); * @return number of bytes written to @p value * @return <0 on error */ -typedef int (*netdev2_test_get_cb_t)(netdev2_t *dev, void *value, - size_t max_len); +typedef int (*netdev_test_get_cb_t)(netdev_t *dev, void *value, + size_t max_len); /** * @brief Callback type to handle set commands @@ -162,49 +162,49 @@ typedef int (*netdev2_test_get_cb_t)(netdev2_t *dev, void *value, * @return number of bytes used from @p value * @return <0 on error */ -typedef int (*netdev2_test_set_cb_t)(netdev2_t *dev, void *value, - size_t value_len); +typedef int (*netdev_test_set_cb_t)(netdev_t *dev, void *value, + size_t value_len); /** - * @brief Device descriptor for @ref sys_netdev2_test devices + * @brief Device descriptor for @ref sys_netdev_test devices * - * @extends netdev2_t + * @extends netdev_t */ typedef struct { /** - * @brief netdev2 fields + * @brief netdev fields * @{ */ -#ifdef MODULE_NETDEV2_IEEE802154 - netdev2_ieee802154_t netdev; /**< superclass */ -#else /* MODULE_NETDEV2_IEEE802154 */ - netdev2_t netdev; /**< superclass */ -#endif /* MODULE_NETDEV2_IEEE802154 */ +#ifdef MODULE_NETDEV_IEEE802154 + netdev_ieee802154_t netdev; /**< superclass */ +#else /* MODULE_NETDEV_IEEE802154 */ + netdev_t netdev; /**< superclass */ +#endif /* MODULE_NETDEV_IEEE802154 */ /** @} */ /** * @brief device specific fields * @{ */ - netdev2_test_send_cb_t send_cb; /**< callback to handle send command */ - netdev2_test_recv_cb_t recv_cb; /**< callback to handle receive command */ - netdev2_test_init_cb_t init_cb; /**< callback to handle initialization events */ - netdev2_test_isr_cb_t isr_cb; /**< callback to handle ISR events */ - netdev2_test_get_cb_t get_cbs[NETOPT_NUMOF]; /**< callback to handle get command */ - netdev2_test_set_cb_t set_cbs[NETOPT_NUMOF]; /**< callback to handle set command */ + netdev_test_send_cb_t send_cb; /**< callback to handle send command */ + netdev_test_recv_cb_t recv_cb; /**< callback to handle receive command */ + netdev_test_init_cb_t init_cb; /**< callback to handle initialization events */ + netdev_test_isr_cb_t isr_cb; /**< callback to handle ISR events */ + netdev_test_get_cb_t get_cbs[NETOPT_NUMOF]; /**< callback to handle get command */ + netdev_test_set_cb_t set_cbs[NETOPT_NUMOF]; /**< callback to handle set command */ void *state; /**< external state for the device */ mutex_t mutex; /**< mutex for the device */ /** @} */ -} netdev2_test_t; +} netdev_test_t; /** * @brief override send callback * - * @param[in] dev a @ref sys_netdev2_test device + * @param[in] dev a @ref sys_netdev_test device * @param[in] send_cb a send callback */ -static inline void netdev2_test_set_send_cb(netdev2_test_t *dev, - netdev2_test_send_cb_t send_cb) +static inline void netdev_test_set_send_cb(netdev_test_t *dev, + netdev_test_send_cb_t send_cb) { mutex_lock(&dev->mutex); dev->send_cb = send_cb; @@ -214,11 +214,11 @@ static inline void netdev2_test_set_send_cb(netdev2_test_t *dev, /** * @brief override receive callback * - * @param[in] dev a @ref sys_netdev2_test device + * @param[in] dev a @ref sys_netdev_test device * @param[in] recv_cb a receive callback */ -static inline void netdev2_test_set_recv_cb(netdev2_test_t *dev, - netdev2_test_recv_cb_t recv_cb) +static inline void netdev_test_set_recv_cb(netdev_test_t *dev, + netdev_test_recv_cb_t recv_cb) { mutex_lock(&dev->mutex); dev->recv_cb = recv_cb; @@ -228,11 +228,11 @@ static inline void netdev2_test_set_recv_cb(netdev2_test_t *dev, /** * @brief override initialization callback * - * @param[in] dev a @ref sys_netdev2_test device + * @param[in] dev a @ref sys_netdev_test device * @param[in] init_cb an initialization callback */ -static inline void netdev2_test_set_init_cb(netdev2_test_t *dev, - netdev2_test_init_cb_t init_cb) +static inline void netdev_test_set_init_cb(netdev_test_t *dev, + netdev_test_init_cb_t init_cb) { mutex_lock(&dev->mutex); dev->init_cb = init_cb; @@ -242,11 +242,11 @@ static inline void netdev2_test_set_init_cb(netdev2_test_t *dev, /** * @brief override ISR event handler callback * - * @param[in] dev a @ref sys_netdev2_test device + * @param[in] dev a @ref sys_netdev_test device * @param[in] isr_cb an ISR event handler callback */ -static inline void netdev2_test_set_isr_cb(netdev2_test_t *dev, - netdev2_test_isr_cb_t isr_cb) +static inline void netdev_test_set_isr_cb(netdev_test_t *dev, + netdev_test_isr_cb_t isr_cb) { mutex_lock(&dev->mutex); dev->isr_cb = isr_cb; @@ -256,12 +256,12 @@ static inline void netdev2_test_set_isr_cb(netdev2_test_t *dev, /** * @brief override get callback for a certain option type * - * @param[in] dev a @ref sys_netdev2_test device + * @param[in] dev a @ref sys_netdev_test device * @param[in] opt an option type * @param[in] get_cb a get callback for @p opt */ -static inline void netdev2_test_set_get_cb(netdev2_test_t *dev, netopt_t opt, - netdev2_test_get_cb_t get_cb) +static inline void netdev_test_set_get_cb(netdev_test_t *dev, netopt_t opt, + netdev_test_get_cb_t get_cb) { mutex_lock(&dev->mutex); dev->get_cbs[opt] = get_cb; @@ -271,12 +271,12 @@ static inline void netdev2_test_set_get_cb(netdev2_test_t *dev, netopt_t opt, /** * @brief override get callback for a certain option type * - * @param[in] dev a @ref sys_netdev2_test device + * @param[in] dev a @ref sys_netdev_test device * @param[in] opt an option type * @param[in] set_cb a set callback for @p opt */ -static inline void netdev2_test_set_set_cb(netdev2_test_t *dev, netopt_t opt, - netdev2_test_set_cb_t set_cb) +static inline void netdev_test_set_set_cb(netdev_test_t *dev, netopt_t opt, + netdev_test_set_cb_t set_cb) { mutex_lock(&dev->mutex); dev->set_cbs[opt] = set_cb; @@ -284,23 +284,23 @@ static inline void netdev2_test_set_set_cb(netdev2_test_t *dev, netopt_t opt, } /** - * @brief Setup a given @ref sys_netdev2_test device + * @brief Setup a given @ref sys_netdev_test device * - * @param[in] dev a @ref sys_netdev2_test device to initialize + * @param[in] dev a @ref sys_netdev_test device to initialize * @param[in] state external state for the device */ -void netdev2_test_setup(netdev2_test_t *dev, void *state); +void netdev_test_setup(netdev_test_t *dev, void *state); /** * @brief Resets all callbacks for the device to NULL * - * @param[in] dev a @ref sys_netdev2_test device to initialize + * @param[in] dev a @ref sys_netdev_test device to initialize */ -void netdev2_test_reset(netdev2_test_t *dev); +void netdev_test_reset(netdev_test_t *dev); #ifdef __cplusplus } #endif -#endif /* NETDEV2_TEST_H */ +#endif /* NETDEV_TEST_H */ /** @} */ diff --git a/sys/include/net/netopt.h b/sys/include/net/netopt.h index 9ef932f756..1d224a103b 100644 --- a/sys/include/net/netopt.h +++ b/sys/include/net/netopt.h @@ -206,7 +206,7 @@ typedef enum { * * Get/set the CCA mode as uint8_t * corresponding to the respective PHY standard. - * - IEEE 802.15.4: @ref netdev2_ieee802154_cca_mode_t + * - IEEE 802.15.4: @ref netdev_ieee802154_cca_mode_t */ NETOPT_CCA_MODE, diff --git a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c index a8ee6a9e64..a881adc221 100644 --- a/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c +++ b/sys/net/gnrc/application_layer/uhcpc/gnrc_uhcpc.c @@ -13,7 +13,7 @@ #include "net/gnrc/netapi.h" #include "net/gnrc/netif.h" #include "net/ipv6/addr.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/netopt.h" #include "net/uhcp.h" diff --git a/pkg/lwip/contrib/netdev2/Makefile b/sys/net/gnrc/link_layer/netdev/Makefile similarity index 60% rename from pkg/lwip/contrib/netdev2/Makefile rename to sys/net/gnrc/link_layer/netdev/Makefile index d6d2e10f9d..fdf8c77651 100644 --- a/pkg/lwip/contrib/netdev2/Makefile +++ b/sys/net/gnrc/link_layer/netdev/Makefile @@ -1,3 +1,3 @@ -MODULE := lwip_netdev2 +MODULE = gnrc_netdev include $(RIOTBASE)/Makefile.base diff --git a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2.c b/sys/net/gnrc/link_layer/netdev/gnrc_netdev.c similarity index 60% rename from sys/net/gnrc/link_layer/netdev2/gnrc_netdev2.c rename to sys/net/gnrc/link_layer/netdev/gnrc_netdev.c index 0bb967ac13..74917add8c 100644 --- a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2.c +++ b/sys/net/gnrc/link_layer/netdev/gnrc_netdev.c @@ -11,7 +11,7 @@ * @{ * @ingroup net * @file - * @brief Glue for netdev2 devices to netapi + * @brief Glue for netdev devices to netapi * * @author Hauke Petersen * @author Kaspar Schleiser @@ -25,9 +25,9 @@ #include "net/gnrc.h" #include "net/gnrc/nettype.h" -#include "net/netdev2.h" +#include "net/netdev.h" -#include "net/gnrc/netdev2.h" +#include "net/gnrc/netdev.h" #include "net/ethernet/hdr.h" #define ENABLE_DEBUG (0) @@ -37,7 +37,7 @@ #include "od.h" #endif -#define NETDEV2_NETAPI_MSG_QUEUE_SIZE 8 +#define NETDEV_NETAPI_MSG_QUEUE_SIZE 8 static void _pass_on_packet(gnrc_pktsnip_t *pkt); @@ -46,26 +46,26 @@ static void _pass_on_packet(gnrc_pktsnip_t *pkt); * * @param[in] event type of event */ -static void _event_cb(netdev2_t *dev, netdev2_event_t event) +static void _event_cb(netdev_t *dev, netdev_event_t event) { - gnrc_netdev2_t *gnrc_netdev2 = (gnrc_netdev2_t*) dev->context; + gnrc_netdev_t *gnrc_netdev = (gnrc_netdev_t*) dev->context; - if (event == NETDEV2_EVENT_ISR) { + if (event == NETDEV_EVENT_ISR) { msg_t msg; - msg.type = NETDEV2_MSG_TYPE_EVENT; - msg.content.ptr = gnrc_netdev2; + msg.type = NETDEV_MSG_TYPE_EVENT; + msg.content.ptr = gnrc_netdev; - if (msg_send(&msg, gnrc_netdev2->pid) <= 0) { - puts("gnrc_netdev2: possibly lost interrupt."); + if (msg_send(&msg, gnrc_netdev->pid) <= 0) { + puts("gnrc_netdev: possibly lost interrupt."); } } else { - DEBUG("gnrc_netdev2: event triggered -> %i\n", event); + DEBUG("gnrc_netdev: event triggered -> %i\n", event); switch(event) { - case NETDEV2_EVENT_RX_COMPLETE: + case NETDEV_EVENT_RX_COMPLETE: { - gnrc_pktsnip_t *pkt = gnrc_netdev2->recv(gnrc_netdev2); + gnrc_pktsnip_t *pkt = gnrc_netdev->recv(gnrc_netdev); if (pkt) { _pass_on_packet(pkt); @@ -74,15 +74,15 @@ static void _event_cb(netdev2_t *dev, netdev2_event_t event) break; } #ifdef MODULE_NETSTATS_L2 - case NETDEV2_EVENT_TX_MEDIUM_BUSY: + case NETDEV_EVENT_TX_MEDIUM_BUSY: dev->stats.tx_failed++; break; - case NETDEV2_EVENT_TX_COMPLETE: + case NETDEV_EVENT_TX_COMPLETE: dev->stats.tx_success++; break; #endif default: - DEBUG("gnrc_netdev2: warning: unhandled event %u.\n", event); + DEBUG("gnrc_netdev: warning: unhandled event %u.\n", event); } } } @@ -91,38 +91,38 @@ static void _pass_on_packet(gnrc_pktsnip_t *pkt) { /* throw away packet if no one is interested */ if (!gnrc_netapi_dispatch_receive(pkt->type, GNRC_NETREG_DEMUX_CTX_ALL, pkt)) { - DEBUG("gnrc_netdev2: unable to forward packet of type %i\n", pkt->type); + DEBUG("gnrc_netdev: unable to forward packet of type %i\n", pkt->type); gnrc_pktbuf_release(pkt); return; } } /** - * @brief Startup code and event loop of the gnrc_netdev2 layer + * @brief Startup code and event loop of the gnrc_netdev layer * * @param[in] args expects a pointer to the underlying netdev device * * @return never returns */ -static void *_gnrc_netdev2_thread(void *args) +static void *_gnrc_netdev_thread(void *args) { - DEBUG("gnrc_netdev2: starting thread\n"); + DEBUG("gnrc_netdev: starting thread\n"); - gnrc_netdev2_t *gnrc_netdev2 = (gnrc_netdev2_t*) args; - netdev2_t *dev = gnrc_netdev2->dev; + gnrc_netdev_t *gnrc_netdev = (gnrc_netdev_t*) args; + netdev_t *dev = gnrc_netdev->dev; - gnrc_netdev2->pid = thread_getpid(); + gnrc_netdev->pid = thread_getpid(); gnrc_netapi_opt_t *opt; int res; - msg_t msg, reply, msg_queue[NETDEV2_NETAPI_MSG_QUEUE_SIZE]; + msg_t msg, reply, msg_queue[NETDEV_NETAPI_MSG_QUEUE_SIZE]; /* setup the MAC layers message queue */ - msg_init_queue(msg_queue, NETDEV2_NETAPI_MSG_QUEUE_SIZE); + msg_init_queue(msg_queue, NETDEV_NETAPI_MSG_QUEUE_SIZE); /* register the event callback with the device driver */ dev->event_callback = _event_cb; - dev->context = (void*) gnrc_netdev2; + dev->context = (void*) gnrc_netdev; /* register the device to the network stack*/ gnrc_netif_add(thread_getpid()); @@ -132,27 +132,27 @@ static void *_gnrc_netdev2_thread(void *args) /* start the event loop */ while (1) { - DEBUG("gnrc_netdev2: waiting for incoming messages\n"); + DEBUG("gnrc_netdev: waiting for incoming messages\n"); msg_receive(&msg); /* dispatch NETDEV and NETAPI messages */ switch (msg.type) { - case NETDEV2_MSG_TYPE_EVENT: - DEBUG("gnrc_netdev2: GNRC_NETDEV_MSG_TYPE_EVENT received\n"); + case NETDEV_MSG_TYPE_EVENT: + DEBUG("gnrc_netdev: GNRC_NETDEV_MSG_TYPE_EVENT received\n"); dev->driver->isr(dev); break; case GNRC_NETAPI_MSG_TYPE_SND: - DEBUG("gnrc_netdev2: GNRC_NETAPI_MSG_TYPE_SND received\n"); + DEBUG("gnrc_netdev: GNRC_NETAPI_MSG_TYPE_SND received\n"); gnrc_pktsnip_t *pkt = msg.content.ptr; - gnrc_netdev2->send(gnrc_netdev2, pkt); + gnrc_netdev->send(gnrc_netdev, pkt); break; case GNRC_NETAPI_MSG_TYPE_SET: /* read incoming options */ opt = msg.content.ptr; - DEBUG("gnrc_netdev2: GNRC_NETAPI_MSG_TYPE_SET received. opt=%s\n", + DEBUG("gnrc_netdev: GNRC_NETAPI_MSG_TYPE_SET received. opt=%s\n", netopt2str(opt->opt)); /* set option for device driver */ res = dev->driver->set(dev, opt->opt, opt->data, opt->data_len); - DEBUG("gnrc_netdev2: response of netdev->set: %i\n", res); + DEBUG("gnrc_netdev: response of netdev->set: %i\n", res); /* send reply to calling thread */ reply.type = GNRC_NETAPI_MSG_TYPE_ACK; reply.content.value = (uint32_t)res; @@ -161,18 +161,18 @@ static void *_gnrc_netdev2_thread(void *args) case GNRC_NETAPI_MSG_TYPE_GET: /* read incoming options */ opt = msg.content.ptr; - DEBUG("gnrc_netdev2: GNRC_NETAPI_MSG_TYPE_GET received. opt=%s\n", + DEBUG("gnrc_netdev: GNRC_NETAPI_MSG_TYPE_GET received. opt=%s\n", netopt2str(opt->opt)); /* get option from device driver */ res = dev->driver->get(dev, opt->opt, opt->data, opt->data_len); - DEBUG("gnrc_netdev2: response of netdev->get: %i\n", res); + DEBUG("gnrc_netdev: response of netdev->get: %i\n", res); /* send reply to calling thread */ reply.type = GNRC_NETAPI_MSG_TYPE_ACK; reply.content.value = (uint32_t)res; msg_reply(&msg, &reply); break; default: - DEBUG("gnrc_netdev2: Unknown command %" PRIu16 "\n", msg.type); + DEBUG("gnrc_netdev: Unknown command %" PRIu16 "\n", msg.type); break; } } @@ -180,19 +180,19 @@ static void *_gnrc_netdev2_thread(void *args) return NULL; } -kernel_pid_t gnrc_netdev2_init(char *stack, int stacksize, char priority, - const char *name, gnrc_netdev2_t *gnrc_netdev2) +kernel_pid_t gnrc_netdev_init(char *stack, int stacksize, char priority, + const char *name, gnrc_netdev_t *gnrc_netdev) { kernel_pid_t res; /* check if given netdev device is defined and the driver is set */ - if (gnrc_netdev2 == NULL || gnrc_netdev2->dev == NULL) { + if (gnrc_netdev == NULL || gnrc_netdev->dev == NULL) { return -ENODEV; } - /* create new gnrc_netdev2 thread */ + /* create new gnrc_netdev thread */ res = thread_create(stack, stacksize, priority, THREAD_CREATE_STACKTEST, - _gnrc_netdev2_thread, (void *)gnrc_netdev2, name); + _gnrc_netdev_thread, (void *)gnrc_netdev, name); if (res <= 0) { return -EINVAL; } diff --git a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_eth.c b/sys/net/gnrc/link_layer/netdev/gnrc_netdev_eth.c similarity index 83% rename from sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_eth.c rename to sys/net/gnrc/link_layer/netdev/gnrc_netdev_eth.c index 35b16d269a..07119b6cbb 100644 --- a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_eth.c +++ b/sys/net/gnrc/link_layer/netdev/gnrc_netdev_eth.c @@ -10,14 +10,14 @@ * @{ * @ingroup net * @file - * @brief gnrc netdev2 ethernet glue code + * @brief gnrc netdev ethernet glue code * * @author Kaspar Schleiser * @} */ #include "net/gnrc.h" -#include "net/gnrc/netdev2.h" +#include "net/gnrc/netdev.h" #include "net/ethernet/hdr.h" #ifdef MODULE_GNRC_IPV6 @@ -29,9 +29,9 @@ #define ENABLE_DEBUG (0) #include "debug.h" -static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) +static gnrc_pktsnip_t *_recv(gnrc_netdev_t *gnrc_netdev) { - netdev2_t *dev = gnrc_netdev2->dev; + netdev_t *dev = gnrc_netdev->dev; int bytes_expected = dev->driver->recv(dev, NULL, 0, NULL); gnrc_pktsnip_t *pkt = NULL; @@ -66,7 +66,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) /* mark ethernet header */ gnrc_pktsnip_t *eth_hdr = gnrc_pktbuf_mark(pkt, sizeof(ethernet_hdr_t), GNRC_NETTYPE_UNDEF); if (!eth_hdr) { - DEBUG("gnrc_netdev2_eth: no space left in packet buffer\n"); + DEBUG("gnrc_netdev_eth: no space left in packet buffer\n"); goto safe_out; } @@ -82,7 +82,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) GNRC_NETTYPE_NETIF); if (netif_hdr == NULL) { - DEBUG("gnrc_netdev2_eth: no space left in packet buffer\n"); + DEBUG("gnrc_netdev_eth: no space left in packet buffer\n"); pkt = eth_hdr; goto safe_out; } @@ -92,7 +92,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) gnrc_netif_hdr_set_dst_addr(netif_hdr->data, hdr->dst, ETHERNET_ADDR_LEN); ((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = thread_getpid(); - DEBUG("gnrc_netdev2_eth: received packet from %02x:%02x:%02x:%02x:%02x:%02x " + DEBUG("gnrc_netdev_eth: received packet from %02x:%02x:%02x:%02x:%02x:%02x " "of length %d\n", hdr->src[0], hdr->src[1], hdr->src[2], hdr->src[3], hdr->src[4], hdr->src[5], nread); @@ -135,24 +135,24 @@ static inline void _addr_set_multicast(uint8_t *dst, gnrc_pktsnip_t *payload) } } -static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netdev_t *gnrc_netdev, gnrc_pktsnip_t *pkt) { ethernet_hdr_t hdr; gnrc_netif_hdr_t *netif_hdr; gnrc_pktsnip_t *payload; int res; - netdev2_t *dev = gnrc_netdev2->dev; + netdev_t *dev = gnrc_netdev->dev; if (pkt == NULL) { - DEBUG("gnrc_netdev2_eth: pkt was NULL\n"); + DEBUG("gnrc_netdev_eth: pkt was NULL\n"); return -EINVAL; } payload = pkt->next; if (pkt->type != GNRC_NETTYPE_NETIF) { - DEBUG("gnrc_netdev2_eth: First header was not generic netif header\n"); + DEBUG("gnrc_netdev_eth: First header was not generic netif header\n"); return -EBADMSG; } @@ -179,7 +179,7 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) } else if (netif_hdr->flags & GNRC_NETIF_HDR_FLAGS_MULTICAST) { if (payload == NULL) { - DEBUG("gnrc_netdev2_eth: empty multicast packets over Ethernet "\ + DEBUG("gnrc_netdev_eth: empty multicast packets over Ethernet "\ "are not yet supported\n"); return -ENOTSUP; } @@ -190,11 +190,11 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) ETHERNET_ADDR_LEN); } else { - DEBUG("gnrc_netdev2_eth: destination address had unexpected format\n"); + DEBUG("gnrc_netdev_eth: destination address had unexpected format\n"); return -EBADMSG; } - DEBUG("gnrc_netdev2_eth: send to %02x:%02x:%02x:%02x:%02x:%02x\n", + DEBUG("gnrc_netdev_eth: send to %02x:%02x:%02x:%02x:%02x:%02x\n", hdr.dst[0], hdr.dst[1], hdr.dst[2], hdr.dst[3], hdr.dst[4], hdr.dst[5]); @@ -210,10 +210,10 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) #ifdef MODULE_NETSTATS_L2 if ((netif_hdr->flags & GNRC_NETIF_HDR_FLAGS_BROADCAST) || (netif_hdr->flags & GNRC_NETIF_HDR_FLAGS_MULTICAST)) { - gnrc_netdev2->dev->stats.tx_mcast_count++; + gnrc_netdev->dev->stats.tx_mcast_count++; } else { - gnrc_netdev2->dev->stats.tx_unicast_count++; + gnrc_netdev->dev->stats.tx_unicast_count++; } #endif res = dev->driver->send(dev, vector, n); @@ -224,11 +224,11 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) return res; } -int gnrc_netdev2_eth_init(gnrc_netdev2_t *gnrc_netdev2, netdev2_t *dev) +int gnrc_netdev_eth_init(gnrc_netdev_t *gnrc_netdev, netdev_t *dev) { - gnrc_netdev2->send = _send; - gnrc_netdev2->recv = _recv; - gnrc_netdev2->dev = dev; + gnrc_netdev->send = _send; + gnrc_netdev->recv = _recv; + gnrc_netdev->dev = dev; return 0; } diff --git a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_ieee802154.c b/sys/net/gnrc/link_layer/netdev/gnrc_netdev_ieee802154.c similarity index 84% rename from sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_ieee802154.c rename to sys/net/gnrc/link_layer/netdev/gnrc_netdev_ieee802154.c index 4903662e1d..662150add1 100644 --- a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_ieee802154.c +++ b/sys/net/gnrc/link_layer/netdev/gnrc_netdev_ieee802154.c @@ -19,20 +19,20 @@ #include "net/gnrc.h" #include "net/ieee802154.h" -#include "net/gnrc/netdev2/ieee802154.h" +#include "net/gnrc/netdev/ieee802154.h" #define ENABLE_DEBUG (0) #include "debug.h" -static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2); -static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt); +static gnrc_pktsnip_t *_recv(gnrc_netdev_t *gnrc_netdev); +static int _send(gnrc_netdev_t *gnrc_netdev, gnrc_pktsnip_t *pkt); -int gnrc_netdev2_ieee802154_init(gnrc_netdev2_t *gnrc_netdev2, - netdev2_ieee802154_t *dev) +int gnrc_netdev_ieee802154_init(gnrc_netdev_t *gnrc_netdev, + netdev_ieee802154_t *dev) { - gnrc_netdev2->send = _send; - gnrc_netdev2->recv = _recv; - gnrc_netdev2->dev = (netdev2_t *)dev; + gnrc_netdev->send = _send; + gnrc_netdev->recv = _recv; + gnrc_netdev->dev = (netdev_t *)dev; return 0; } @@ -64,11 +64,11 @@ static gnrc_pktsnip_t *_make_netif_hdr(uint8_t *mhr) return snip; } -static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) +static gnrc_pktsnip_t *_recv(gnrc_netdev_t *gnrc_netdev) { - netdev2_t *netdev = gnrc_netdev2->dev; - netdev2_ieee802154_rx_info_t rx_info; - netdev2_ieee802154_t *state = (netdev2_ieee802154_t *)gnrc_netdev2->dev; + netdev_t *netdev = gnrc_netdev->dev; + netdev_ieee802154_rx_info_t rx_info; + netdev_ieee802154_t *state = (netdev_ieee802154_t *)gnrc_netdev->dev; gnrc_pktsnip_t *pkt = NULL; int bytes_expected = netdev->driver->recv(netdev, NULL, 0, NULL); @@ -85,7 +85,7 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) gnrc_pktbuf_release(pkt); return NULL; } - if (!(state->flags & NETDEV2_IEEE802154_RAW)) { + if (!(state->flags & NETDEV_IEEE802154_RAW)) { gnrc_pktsnip_t *ieee802154_hdr, *netif_hdr; gnrc_netif_hdr_t *hdr; #if ENABLE_DEBUG @@ -138,17 +138,17 @@ static gnrc_pktsnip_t *_recv(gnrc_netdev2_t *gnrc_netdev2) return pkt; } -static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) +static int _send(gnrc_netdev_t *gnrc_netdev, gnrc_pktsnip_t *pkt) { - netdev2_t *netdev = gnrc_netdev2->dev; - netdev2_ieee802154_t *state = (netdev2_ieee802154_t *)gnrc_netdev2->dev; + netdev_t *netdev = gnrc_netdev->dev; + netdev_ieee802154_t *state = (netdev_ieee802154_t *)gnrc_netdev->dev; gnrc_netif_hdr_t *netif_hdr; gnrc_pktsnip_t *vec_snip; const uint8_t *src, *dst = NULL; int res = 0; size_t n, src_len, dst_len; uint8_t mhr[IEEE802154_MAX_HDR_LEN]; - uint8_t flags = (uint8_t)(state->flags & NETDEV2_IEEE802154_SEND_MASK); + uint8_t flags = (uint8_t)(state->flags & NETDEV_IEEE802154_SEND_MASK); le_uint16_t dev_pan = byteorder_btols(byteorder_htons(state->pan)); flags |= IEEE802154_FCF_TYPE_DATA; @@ -175,7 +175,7 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) if (src_len > 0) { src = gnrc_netif_hdr_get_src_addr(netif_hdr); } - else if (state->flags & NETDEV2_IEEE802154_SRC_MODE_LONG) { + else if (state->flags & NETDEV_IEEE802154_SRC_MODE_LONG) { src_len = IEEE802154_LONG_ADDRESS_LEN; src = state->long_addr; } @@ -202,10 +202,10 @@ static int _send(gnrc_netdev2_t *gnrc_netdev2, gnrc_pktsnip_t *pkt) #ifdef MODULE_NETSTATS_L2 if (netif_hdr->flags & (GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST)) { - gnrc_netdev2->dev->stats.tx_mcast_count++; + gnrc_netdev->dev->stats.tx_mcast_count++; } else { - gnrc_netdev2->dev->stats.tx_unicast_count++; + gnrc_netdev->dev->stats.tx_unicast_count++; } #endif res = netdev->driver->send(netdev, vector, n); diff --git a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_xbee.c b/sys/net/gnrc/link_layer/netdev/gnrc_netdev_xbee.c similarity index 91% rename from sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_xbee.c rename to sys/net/gnrc/link_layer/netdev/gnrc_netdev_xbee.c index 84a5e14abb..3f06d32bec 100644 --- a/sys/net/gnrc/link_layer/netdev2/gnrc_netdev2_xbee.c +++ b/sys/net/gnrc/link_layer/netdev/gnrc_netdev_xbee.c @@ -21,16 +21,16 @@ #include "assert.h" #include "xbee.h" #include "net/gnrc.h" -#include "net/gnrc/netdev2/xbee_adpt.h" +#include "net/gnrc/netdev/xbee_adpt.h" #define ENABLE_DEBUG (0) #include "debug.h" #define BCAST (GNRC_NETIF_HDR_FLAGS_BROADCAST | GNRC_NETIF_HDR_FLAGS_MULTICAST) -static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netdev2_t *gnrc_netdev2) +static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netdev_t *gnrc_netdev) { - netdev2_t *dev = gnrc_netdev2->dev; + netdev_t *dev = gnrc_netdev->dev; int pktlen; int xhdr_len; gnrc_pktsnip_t *payload; @@ -86,7 +86,7 @@ static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netdev2_t *gnrc_netdev2) return NULL; } netif = (gnrc_netif_hdr_t *)netif_snip->data; - netif->if_pid = gnrc_netdev2->pid; + netif->if_pid = gnrc_netdev->pid; netif->rssi = l2hdr.rssi; if (l2hdr.bcast) { netif->flags = GNRC_NETIF_HDR_FLAGS_BROADCAST; @@ -100,7 +100,7 @@ static gnrc_pktsnip_t *xbee_adpt_recv(gnrc_netdev2_t *gnrc_netdev2) return payload; } -static int xbee_adpt_send(gnrc_netdev2_t *dev, gnrc_pktsnip_t *pkt) +static int xbee_adpt_send(gnrc_netdev_t *dev, gnrc_pktsnip_t *pkt) { int res; size_t size; @@ -172,11 +172,11 @@ static int xbee_adpt_send(gnrc_netdev2_t *dev, gnrc_pktsnip_t *pkt) return res; } -void gnrc_netdev2_xbee_init(gnrc_netdev2_t *gnrc_netdev2, xbee_t *dev) +void gnrc_netdev_xbee_init(gnrc_netdev_t *gnrc_netdev, xbee_t *dev) { - assert(gnrc_netdev2 && dev); + assert(gnrc_netdev && dev); - gnrc_netdev2->send = xbee_adpt_send; - gnrc_netdev2->recv = xbee_adpt_recv; - gnrc_netdev2->dev = (netdev2_t *)dev; + gnrc_netdev->send = xbee_adpt_send; + gnrc_netdev->recv = xbee_adpt_recv; + gnrc_netdev->dev = (netdev_t *)dev; } diff --git a/sys/net/link_layer/csma_sender/csma_sender.c b/sys/net/link_layer/csma_sender/csma_sender.c index 153172e0c0..1530f7832e 100644 --- a/sys/net/link_layer/csma_sender/csma_sender.c +++ b/sys/net/link_layer/csma_sender/csma_sender.c @@ -24,7 +24,7 @@ #include "xtimer.h" #include "random.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "net/netopt.h" #include "net/csma_sender.h" @@ -82,13 +82,13 @@ static inline uint32_t choose_backoff_period(int be, * @param[in] count number of elements in @p vector * * @return the return value of device driver's - * netdev2_driver_t::send() function if medium was + * netdev_driver_t::send() function if medium was * available * @return -ECANCELED if an internal driver error occurred * @return -EBUSY if radio medium was not available * to send the given data */ -static int send_if_cca(netdev2_t *device, struct iovec *vector, unsigned count) +static int send_if_cca(netdev_t *device, struct iovec *vector, unsigned count) { netopt_enable_t hwfeat; @@ -117,7 +117,7 @@ static int send_if_cca(netdev2_t *device, struct iovec *vector, unsigned count) /*------------------------- "EXPORTED" FUNCTIONS -------------------------*/ -int csma_sender_csma_ca_send(netdev2_t *dev, struct iovec *vector, +int csma_sender_csma_ca_send(netdev_t *dev, struct iovec *vector, unsigned count, const csma_sender_conf_t *conf) { netopt_enable_t hwfeat; @@ -195,7 +195,7 @@ int csma_sender_csma_ca_send(netdev2_t *dev, struct iovec *vector, } -int csma_sender_cca_send(netdev2_t *dev, struct iovec *vector, unsigned count) +int csma_sender_cca_send(netdev_t *dev, struct iovec *vector, unsigned count) { netopt_enable_t hwfeat; diff --git a/sys/net/netdev2_test/Makefile b/sys/net/netdev_test/Makefile similarity index 100% rename from sys/net/netdev2_test/Makefile rename to sys/net/netdev_test/Makefile diff --git a/sys/net/netdev2_test/netdev2_test.c b/sys/net/netdev_test/netdev_test.c similarity index 64% rename from sys/net/netdev2_test/netdev2_test.c rename to sys/net/netdev_test/netdev_test.c index bfe2729409..e0032f61a7 100644 --- a/sys/net/netdev2_test/netdev2_test.c +++ b/sys/net/netdev_test/netdev_test.c @@ -17,16 +17,16 @@ #include #include -#include "net/netdev2_test.h" +#include "net/netdev_test.h" -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count); -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info); -static int _init(netdev2_t *dev); -static void _isr(netdev2_t *dev); -static int _get(netdev2_t *dev, netopt_t opt, void *value, size_t max_len); -static int _set(netdev2_t *dev, netopt_t opt, void *value, size_t value_len); +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count); +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info); +static int _init(netdev_t *dev); +static void _isr(netdev_t *dev); +static int _get(netdev_t *dev, netopt_t opt, void *value, size_t max_len); +static int _set(netdev_t *dev, netopt_t opt, void *value, size_t value_len); -static const netdev2_driver_t _driver = { +static const netdev_driver_t _driver = { .send = _send, .recv = _recv, .init = _init, @@ -35,17 +35,17 @@ static const netdev2_driver_t _driver = { .set = _set, }; -void netdev2_test_setup(netdev2_test_t *dev, void *state) +void netdev_test_setup(netdev_test_t *dev, void *state) { - netdev2_t *netdev = (netdev2_t *)dev; + netdev_t *netdev = (netdev_t *)dev; netdev->driver = &_driver; dev->state = state; mutex_init(&dev->mutex); - netdev2_test_reset(dev); + netdev_test_reset(dev); } -void netdev2_test_reset(netdev2_test_t *dev) +void netdev_test_reset(netdev_test_t *dev) { mutex_lock(&dev->mutex); dev->send_cb = NULL; @@ -57,9 +57,9 @@ void netdev2_test_reset(netdev2_test_t *dev) mutex_unlock(&dev->mutex); } -static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) +static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { - netdev2_test_t *dev = (netdev2_test_t *)netdev; + netdev_test_t *dev = (netdev_test_t *)netdev; int res = (int)count; /* assume everything would be fine */ mutex_lock(&dev->mutex); @@ -70,9 +70,9 @@ static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned count) return res; } -static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) +static int _recv(netdev_t *netdev, void *buf, size_t len, void *info) { - netdev2_test_t *dev = (netdev2_test_t *)netdev; + netdev_test_t *dev = (netdev_test_t *)netdev; int res = (buf == NULL) ? 0 : len; /* assume everything would be fine */ mutex_lock(&dev->mutex); @@ -87,9 +87,9 @@ static int _recv(netdev2_t *netdev, void *buf, size_t len, void *info) return res; } -static int _init(netdev2_t *netdev) +static int _init(netdev_t *netdev) { - netdev2_test_t *dev = (netdev2_test_t *)netdev; + netdev_test_t *dev = (netdev_test_t *)netdev; int res = 0; /* assume everything would be fine */ mutex_lock(&dev->mutex); @@ -100,9 +100,9 @@ static int _init(netdev2_t *netdev) return res; } -static void _isr(netdev2_t *netdev) +static void _isr(netdev_t *netdev) { - netdev2_test_t *dev = (netdev2_test_t *)netdev; + netdev_test_t *dev = (netdev_test_t *)netdev; mutex_lock(&dev->mutex); if (dev->isr_cb != NULL) { @@ -114,9 +114,9 @@ static void _isr(netdev2_t *netdev) } } -static int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) +static int _get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len) { - netdev2_test_t *dev = (netdev2_test_t *)netdev; + netdev_test_t *dev = (netdev_test_t *)netdev; int res = -ENOTSUP; /* option assumed to be not supported */ mutex_lock(&dev->mutex); @@ -127,9 +127,9 @@ static int _get(netdev2_t *netdev, netopt_t opt, void *value, size_t max_len) return res; } -static int _set(netdev2_t *netdev, netopt_t opt, void *value, size_t value_len) +static int _set(netdev_t *netdev, netopt_t opt, void *value, size_t value_len) { - netdev2_test_t *dev = (netdev2_test_t *)netdev; + netdev_test_t *dev = (netdev_test_t *)netdev; int res = -ENOTSUP; /* option assumed to be not supported */ mutex_lock(&dev->mutex); diff --git a/tests/driver_at86rf2xx/cmd.c b/tests/driver_at86rf2xx/cmd.c index 10d44df3f9..877fb39801 100644 --- a/tests/driver_at86rf2xx/cmd.c +++ b/tests/driver_at86rf2xx/cmd.c @@ -18,7 +18,7 @@ #include #include -#include "net/netdev2/ieee802154.h" +#include "net/netdev/ieee802154.h" #include "net/ieee802154.h" #include "common.h" @@ -35,9 +35,9 @@ int ifconfig_list(int idx) { int res; uint8_t array_val[_MAX_ADDR_LEN]; - netdev2_ieee802154_t *dev = (netdev2_ieee802154_t *)(&devs[idx]); + netdev_ieee802154_t *dev = (netdev_ieee802154_t *)(&devs[idx]); - int (*get)(netdev2_t *, netopt_t, void *, size_t) = dev->netdev.driver->get; + int (*get)(netdev_t *, netopt_t, void *, size_t) = dev->netdev.driver->get; netopt_enable_t enable_val; uint16_t u16_val; @@ -47,21 +47,21 @@ int ifconfig_list(int idx) print_addr(dev->long_addr, IEEE802154_LONG_ADDRESS_LEN); printf(", PAN: 0x%04x", dev->pan); - res = get((netdev2_t *)dev, NETOPT_ADDR_LEN, &u16_val, sizeof(u16_val)); + res = get((netdev_t *)dev, NETOPT_ADDR_LEN, &u16_val, sizeof(u16_val)); if (res < 0) { puts("(err)"); return 1; } printf("\n Address length: %u", (unsigned)u16_val); - res = get((netdev2_t *)dev, NETOPT_SRC_LEN, &u16_val, sizeof(u16_val)); + res = get((netdev_t *)dev, NETOPT_SRC_LEN, &u16_val, sizeof(u16_val)); if (res < 0) { puts("(err)"); return 1; } printf(", Source address length: %u", (unsigned)u16_val); - res = get((netdev2_t *)dev, NETOPT_MAX_PACKET_SIZE, &u16_val, + res = get((netdev_t *)dev, NETOPT_MAX_PACKET_SIZE, &u16_val, sizeof(u16_val)); if (res < 0) { puts("(err)"); @@ -69,7 +69,7 @@ int ifconfig_list(int idx) } printf(", Max.Payload: %u", (unsigned)u16_val); - res = get((netdev2_t *)dev, NETOPT_IPV6_IID, array_val, sizeof(array_val)); + res = get((netdev_t *)dev, NETOPT_IPV6_IID, array_val, sizeof(array_val)); if (res > 0) { printf("\n IPv6 IID: "); print_addr(array_val, res); @@ -77,20 +77,20 @@ int ifconfig_list(int idx) printf("\n Channel: %u", dev->chan); - res = get((netdev2_t *)dev, NETOPT_CHANNEL_PAGE, &u16_val, sizeof(u16_val)); + res = get((netdev_t *)dev, NETOPT_CHANNEL_PAGE, &u16_val, sizeof(u16_val)); if (res < 0) { puts("(err)"); return 1; } printf(", Ch.page: %u", (unsigned)u16_val); - res = get((netdev2_t *)dev, NETOPT_TX_POWER, &u16_val, sizeof(u16_val)); + res = get((netdev_t *)dev, NETOPT_TX_POWER, &u16_val, sizeof(u16_val)); if (res < 0) { puts("(err)"); return 1; } printf(", TXPower: %d dBm", (int)u16_val); - res = get((netdev2_t *)dev, NETOPT_IS_WIRED, &u16_val, sizeof(u16_val)); + res = get((netdev_t *)dev, NETOPT_IS_WIRED, &u16_val, sizeof(u16_val)); if (res < 0) { puts(", wireless"); } @@ -99,27 +99,27 @@ int ifconfig_list(int idx) } printf(" "); - res = get((netdev2_t *)dev, NETOPT_PRELOADING, &enable_val, + res = get((netdev_t *)dev, NETOPT_PRELOADING, &enable_val, sizeof(netopt_enable_t)); if ((res > 0) && (enable_val == NETOPT_ENABLE)) { printf(" PRELOAD"); } - res = get((netdev2_t *)dev, NETOPT_AUTOACK, &enable_val, + res = get((netdev_t *)dev, NETOPT_AUTOACK, &enable_val, sizeof(netopt_enable_t)); if ((res > 0) && (enable_val == NETOPT_ENABLE)) { printf(" AUTOACK"); } - res = get((netdev2_t *)dev, NETOPT_RAWMODE, &enable_val, + res = get((netdev_t *)dev, NETOPT_RAWMODE, &enable_val, sizeof(netopt_enable_t)); if ((res > 0) && (enable_val == NETOPT_ENABLE)) { printf(" RAW"); } - res = get((netdev2_t *)dev, NETOPT_AUTOCCA, &enable_val, + res = get((netdev_t *)dev, NETOPT_AUTOCCA, &enable_val, sizeof(netopt_enable_t)); if ((res > 0) && (enable_val == NETOPT_ENABLE)) { printf(" AUTOCCA"); } - res = get((netdev2_t *)dev, NETOPT_CSMA, &enable_val, + res = get((netdev_t *)dev, NETOPT_CSMA, &enable_val, sizeof(netopt_enable_t)); if ((res > 0) && (enable_val == NETOPT_ENABLE)) { printf(" CSMA"); @@ -247,7 +247,7 @@ static int send(int iface, le_uint16_t dst_pan, uint8_t *dst, size_t dst_len, char *data) { int res; - netdev2_ieee802154_t *dev; + netdev_ieee802154_t *dev; const size_t count = 2; /* mhr + payload */ struct iovec vector[count]; uint8_t *src; @@ -261,8 +261,8 @@ static int send(int iface, le_uint16_t dst_pan, uint8_t *dst, size_t dst_len, return 1; } - dev = (netdev2_ieee802154_t *)&devs[iface]; - flags = (uint8_t)(dev->flags & NETDEV2_IEEE802154_SEND_MASK); + dev = (netdev_ieee802154_t *)&devs[iface]; + flags = (uint8_t)(dev->flags & NETDEV_IEEE802154_SEND_MASK); flags |= IEEE802154_FCF_TYPE_DATA; vector[1].iov_base = data; vector[1].iov_len = strlen(data); @@ -270,7 +270,7 @@ static int send(int iface, le_uint16_t dst_pan, uint8_t *dst, size_t dst_len, if (dst_pan.u16 == 0) { dst_pan = src_pan; } - if (dev->flags & NETDEV2_IEEE802154_SRC_MODE_LONG) { + if (dev->flags & NETDEV_IEEE802154_SRC_MODE_LONG) { src_len = 8; src = dev->long_addr; } @@ -288,7 +288,7 @@ static int send(int iface, le_uint16_t dst_pan, uint8_t *dst, size_t dst_len, } vector[0].iov_base = mhr; vector[0].iov_len = (size_t)res; - res = dev->netdev.driver->send((netdev2_t *)dev, vector, count); + res = dev->netdev.driver->send((netdev_t *)dev, vector, count); if (res < 0) { puts("txtsnd: Error on sending"); return 1; diff --git a/tests/driver_at86rf2xx/common.h b/tests/driver_at86rf2xx/common.h index b81ab4553f..a624bf39fd 100644 --- a/tests/driver_at86rf2xx/common.h +++ b/tests/driver_at86rf2xx/common.h @@ -22,7 +22,7 @@ #include "at86rf2xx.h" #include "at86rf2xx_params.h" -#include "net/netdev2.h" +#include "net/netdev.h" #ifdef __cplusplus extern "C" { @@ -37,7 +37,7 @@ extern "C" { extern at86rf2xx_t devs[AT86RF2XX_NUM]; -void recv(netdev2_t *dev); +void recv(netdev_t *dev); int ifconfig(int argc, char **argv); int txtsnd(int argc, char **argv); void print_addr(uint8_t *addr, size_t addr_len); diff --git a/tests/driver_at86rf2xx/main.c b/tests/driver_at86rf2xx/main.c index 6842e5600a..27f1eef3b4 100644 --- a/tests/driver_at86rf2xx/main.c +++ b/tests/driver_at86rf2xx/main.c @@ -20,7 +20,7 @@ #include -#include "net/netdev2.h" +#include "net/netdev.h" #include "shell.h" #include "shell_commands.h" #include "thread.h" @@ -37,26 +37,26 @@ static kernel_pid_t _recv_pid; at86rf2xx_t devs[AT86RF2XX_NUM]; static const shell_command_t shell_commands[] = { - { "ifconfig", "Configure netdev2", ifconfig }, + { "ifconfig", "Configure netdev", ifconfig }, { "txtsnd", "Send IEEE 802.15.4 packet", txtsnd }, { NULL, NULL, NULL } }; -static void _event_cb(netdev2_t *dev, netdev2_event_t event) +static void _event_cb(netdev_t *dev, netdev_event_t event) { - if (event == NETDEV2_EVENT_ISR) { + if (event == NETDEV_EVENT_ISR) { msg_t msg; msg.type = MSG_TYPE_ISR; msg.content.ptr = dev; if (msg_send(&msg, _recv_pid) <= 0) { - puts("gnrc_netdev2: possibly lost interrupt."); + puts("gnrc_netdev: possibly lost interrupt."); } } else { switch (event) { - case NETDEV2_EVENT_RX_COMPLETE: + case NETDEV_EVENT_RX_COMPLETE: { recv(dev); @@ -75,7 +75,7 @@ void *_recv_thread(void *arg) msg_t msg; msg_receive(&msg); if (msg.type == MSG_TYPE_ISR) { - netdev2_t *dev = msg.content.ptr; + netdev_t *dev = msg.content.ptr; dev->driver->isr(dev); } else { @@ -91,7 +91,7 @@ int main(void) for (unsigned i = 0; i < AT86RF2XX_NUM; i++) { const at86rf2xx_params_t *p = &at86rf2xx_params[i]; - netdev2_t *dev = (netdev2_t *)(&devs[i]); + netdev_t *dev = (netdev_t *)(&devs[i]); printf("Initializing AT86RF2xx radio at SPI_%d\n", p->spi); at86rf2xx_setup(&devs[i], (at86rf2xx_params_t*) p); diff --git a/tests/driver_at86rf2xx/recv.c b/tests/driver_at86rf2xx/recv.c index 780a8833cd..1c59647627 100644 --- a/tests/driver_at86rf2xx/recv.c +++ b/tests/driver_at86rf2xx/recv.c @@ -18,7 +18,7 @@ #include "at86rf2xx.h" #include "od.h" #include "net/ieee802154.h" -#include "net/netdev2.h" +#include "net/netdev.h" #include "common.h" @@ -26,11 +26,11 @@ static uint8_t buffer[AT86RF2XX_MAX_PKT_LENGTH]; -void recv(netdev2_t *dev) +void recv(netdev_t *dev) { uint8_t src[IEEE802154_LONG_ADDRESS_LEN], dst[IEEE802154_LONG_ADDRESS_LEN]; size_t mhr_len, data_len, src_len, dst_len; - netdev2_ieee802154_rx_info_t rx_info; + netdev_ieee802154_rx_info_t rx_info; le_uint16_t src_pan, dst_pan; putchar('\n'); diff --git a/tests/driver_enc28j60/Makefile b/tests/driver_enc28j60/Makefile index ba0225b91a..00a8e8a214 100644 --- a/tests/driver_enc28j60/Makefile +++ b/tests/driver_enc28j60/Makefile @@ -6,7 +6,7 @@ FEATURES_REQUIRED = periph_spi periph_gpio BOARD_INSUFFICIENT_MEMORY := msb-430 msb-430h nucleo-f334 nucleo-l053 \ stm32f0discovery telosb weio z1 -USEMODULE += gnrc_netdev2 +USEMODULE += gnrc_netdev USEMODULE += gnrc_netdev_default USEMODULE += auto_init_gnrc_netif USEMODULE += enc28j60 diff --git a/tests/driver_encx24j600/Makefile b/tests/driver_encx24j600/Makefile index ac432efb5c..3da054925e 100644 --- a/tests/driver_encx24j600/Makefile +++ b/tests/driver_encx24j600/Makefile @@ -6,7 +6,7 @@ FEATURES_REQUIRED = periph_spi periph_gpio BOARD_INSUFFICIENT_MEMORY := msb-430 msb-430h nucleo-l053 stm32f0discovery telosb \ weio z1 -USEMODULE += gnrc_netdev2 +USEMODULE += gnrc_netdev USEMODULE += gnrc_netdev_default USEMODULE += auto_init_gnrc_netif USEMODULE += encx24j600 diff --git a/tests/driver_xbee/Makefile b/tests/driver_xbee/Makefile index e2a6372069..e5e12726de 100644 --- a/tests/driver_xbee/Makefile +++ b/tests/driver_xbee/Makefile @@ -9,7 +9,7 @@ BOARD_INSUFFICIENT_MEMORY := nucleo32-f031 nucleo32-f042 nucleo-f030 nucleo-f334 USEMODULE += xbee USEMODULE += gnrc_netif USEMODULE += gnrc_txtsnd -USEMODULE += gnrc_netdev2 +USEMODULE += gnrc_netdev USEMODULE += auto_init_gnrc_netif USEMODULE += gnrc_pktdump USEMODULE += shell diff --git a/tests/emb6/main.c b/tests/emb6/main.c index 85ad72a444..9f833acc5a 100644 --- a/tests/emb6/main.c +++ b/tests/emb6/main.c @@ -27,7 +27,7 @@ #include "at86rf2xx_params.h" #include "common.h" #include "emb6.h" -#include "emb6/netdev2.h" +#include "emb6/netdev.h" #include "uip-ds6.h" #include "net/ipv6/addr.h" #include "shell.h" @@ -90,13 +90,13 @@ char conn_inbuf[CONN_INBUF_SIZE]; int main(void) { - netdev2_t *netdev = (netdev2_t *)&at86rf2xx; + netdev_t *netdev = (netdev_t *)&at86rf2xx; puts("RIOT emb6 test application"); at86rf2xx_setup(&at86rf2xx, at86rf2xx_params); - netdev->driver->init((netdev2_t *)&at86rf2xx); - emb6_netdev2_setup(netdev); + netdev->driver->init((netdev_t *)&at86rf2xx); + emb6_netdev_setup(netdev); emb6_init(&emb6); thread_create(emb6_stack, sizeof(emb6_stack), EMB6_PRIO, THREAD_CREATE_STACKTEST, _emb6_thread, NULL, "emb6"); diff --git a/tests/lwip/Makefile b/tests/lwip/Makefile index 8be36f605c..7a8dc63709 100644 --- a/tests/lwip/Makefile +++ b/tests/lwip/Makefile @@ -13,7 +13,7 @@ BOARD_INSUFFICIENT_MEMORY := airfy-beacon arduino-mega2560 msb-430h nrf6310 \ yunjia-nrf51822 z1 # including lwip_ipv6_mld would currently break this test on at86rf2xx radios -USEMODULE += lwip lwip_ipv6_autoconfig lwip_conn_ip lwip_netdev2 +USEMODULE += lwip lwip_ipv6_autoconfig lwip_conn_ip lwip_netdev USEMODULE += lwip_udp lwip_conn_udp USEMODULE += ipv6_addr USEMODULE += shell @@ -35,7 +35,7 @@ ifneq (,$(filter mulle,$(BOARD))) DRIVER := at86rf212b endif ifneq (,$(filter native,$(BOARD))) - DRIVER := netdev2_tap + DRIVER := netdev_tap USEMODULE += lwip_ethernet endif diff --git a/tests/lwip_sock_ip/Makefile b/tests/lwip_sock_ip/Makefile index 9670a76c2f..0ec1c6200b 100644 --- a/tests/lwip_sock_ip/Makefile +++ b/tests/lwip_sock_ip/Makefile @@ -27,10 +27,10 @@ ifneq (0, $(LWIP_IPV6)) endif USEMODULE += inet_csum -USEMODULE += lwip_ethernet lwip_netdev2 +USEMODULE += lwip_ethernet lwip_netdev USEMODULE += lwip_sock_ip -USEMODULE += netdev2_eth -USEMODULE += netdev2_test +USEMODULE += netdev_eth +USEMODULE += netdev_test USEMODULE += ps DISABLE_MODULE += auto_init diff --git a/tests/lwip_sock_ip/README.md b/tests/lwip_sock_ip/README.md index b826a0458d..9f789db0b3 100644 --- a/tests/lwip_sock_ip/README.md +++ b/tests/lwip_sock_ip/README.md @@ -2,7 +2,7 @@ Tests for lwIP's sock_ip port ============================= This tests the `sock_ip` port of lwIP. There is no network device needed since -a [virtual device](http://doc.riot-os.org/group__sys__netdev2__test.html) is +a [virtual device](http://doc.riot-os.org/group__sys__netdev__test.html) is provided at the backend. These tests test both IPv4 and IPv6 capabilities. They can be activated by diff --git a/tests/lwip_sock_ip/stack.c b/tests/lwip_sock_ip/stack.c index 1c4d0f826a..153a0e7809 100644 --- a/tests/lwip_sock_ip/stack.c +++ b/tests/lwip_sock_ip/stack.c @@ -17,8 +17,8 @@ #include "msg.h" #include "net/ethernet.h" #include "net/ipv6.h" -#include "net/netdev2/eth.h" -#include "net/netdev2_test.h" +#include "net/netdev/eth.h" +#include "net/netdev_test.h" #include "net/sock.h" #include "sched.h" #include "xtimer.h" @@ -28,7 +28,7 @@ #include "lwip/inet_chksum.h" #include "lwip/nd6.h" #include "lwip/netif.h" -#include "lwip/netif/netdev2.h" +#include "lwip/netif/netdev.h" #include "lwip/tcpip.h" #include "netif/etharp.h" @@ -41,7 +41,7 @@ static msg_t _msg_queue[_MSG_QUEUE_SIZE]; static uint8_t _netdev_buffer[_NETDEV_BUFFER_SIZE]; -netdev2_test_t netdev; +netdev_test_t netdev; static struct netif netif; static kernel_pid_t _check_pid = KERNEL_PID_UNDEF; static mutex_t _netdev_buffer_mutex = MUTEX_INIT; @@ -55,12 +55,12 @@ static inline void _get_iid(uint8_t *iid) iid[0] ^= 0x2; } -static int _get_max_pkt_size(netdev2_t *dev, void *value, size_t max_len) +static int _get_max_pkt_size(netdev_t *dev, void *value, size_t max_len) { - return netdev2_eth_get(dev, NETOPT_MAX_PACKET_SIZE, value, max_len); + return netdev_eth_get(dev, NETOPT_MAX_PACKET_SIZE, value, max_len); } -static int _get_src_len(netdev2_t *dev, void *value, size_t max_len) +static int _get_src_len(netdev_t *dev, void *value, size_t max_len) { uint16_t *v = value; @@ -74,7 +74,7 @@ static int _get_src_len(netdev2_t *dev, void *value, size_t max_len) return sizeof(uint16_t); } -static int _get_addr(netdev2_t *dev, void *value, size_t max_len) +static int _get_addr(netdev_t *dev, void *value, size_t max_len) { uint8_t iid[ETHERNET_ADDR_LEN + 2]; uint8_t *addr = value; @@ -96,17 +96,17 @@ static int _get_addr(netdev2_t *dev, void *value, size_t max_len) return ETHERNET_ADDR_LEN; } -static int _get_addr_len(netdev2_t *dev, void *value, size_t max_len) +static int _get_addr_len(netdev_t *dev, void *value, size_t max_len) { - return netdev2_eth_get(dev, NETOPT_ADDR_LEN, value, max_len); + return netdev_eth_get(dev, NETOPT_ADDR_LEN, value, max_len); } -static int _get_device_type(netdev2_t *dev, void *value, size_t max_len) +static int _get_device_type(netdev_t *dev, void *value, size_t max_len) { - return netdev2_eth_get(dev, NETOPT_DEVICE_TYPE, value, max_len); + return netdev_eth_get(dev, NETOPT_DEVICE_TYPE, value, max_len); } -static int _get_ipv6_iid(netdev2_t *dev, void *value, size_t max_len) +static int _get_ipv6_iid(netdev_t *dev, void *value, size_t max_len) { (void)dev; if (max_len != sizeof(uint64_t)) { @@ -116,12 +116,12 @@ static int _get_ipv6_iid(netdev2_t *dev, void *value, size_t max_len) return sizeof(uint64_t); } -static void _netdev_isr(netdev2_t *dev) +static void _netdev_isr(netdev_t *dev) { - dev->event_callback(dev, NETDEV2_EVENT_RX_COMPLETE); + dev->event_callback(dev, NETDEV_EVENT_RX_COMPLETE); } -static int _netdev_recv(netdev2_t *dev, char *buf, int len, void *info) +static int _netdev_recv(netdev_t *dev, char *buf, int len, void *info) { int res; @@ -140,7 +140,7 @@ static int _netdev_recv(netdev2_t *dev, char *buf, int len, void *info) return res; } -static int _netdev_send(netdev2_t *dev, const struct iovec *vector, int count) +static int _netdev_send(netdev_t *dev, const struct iovec *vector, int count) { msg_t done = { .type = _SEND_DONE }; unsigned offset = 0; @@ -167,21 +167,21 @@ void _net_init(void) msg_init_queue(_msg_queue, _MSG_QUEUE_SIZE); _check_pid = sched_active_pid; - netdev2_test_setup(&netdev, NULL); - netdev2_test_set_get_cb(&netdev, NETOPT_SRC_LEN, _get_src_len); - netdev2_test_set_get_cb(&netdev, NETOPT_MAX_PACKET_SIZE, + netdev_test_setup(&netdev, NULL); + netdev_test_set_get_cb(&netdev, NETOPT_SRC_LEN, _get_src_len); + netdev_test_set_get_cb(&netdev, NETOPT_MAX_PACKET_SIZE, _get_max_pkt_size); - netdev2_test_set_get_cb(&netdev, NETOPT_ADDRESS, _get_addr); - netdev2_test_set_get_cb(&netdev, NETOPT_ADDR_LEN, + netdev_test_set_get_cb(&netdev, NETOPT_ADDRESS, _get_addr); + netdev_test_set_get_cb(&netdev, NETOPT_ADDR_LEN, _get_addr_len); - netdev2_test_set_get_cb(&netdev, NETOPT_SRC_LEN, + netdev_test_set_get_cb(&netdev, NETOPT_SRC_LEN, _get_addr_len); - netdev2_test_set_get_cb(&netdev, NETOPT_DEVICE_TYPE, + netdev_test_set_get_cb(&netdev, NETOPT_DEVICE_TYPE, _get_device_type); - netdev2_test_set_get_cb(&netdev, NETOPT_IPV6_IID, + netdev_test_set_get_cb(&netdev, NETOPT_IPV6_IID, _get_ipv6_iid); - netdev2_test_set_recv_cb(&netdev, _netdev_recv); - netdev2_test_set_isr_cb(&netdev, _netdev_isr); + netdev_test_set_recv_cb(&netdev, _netdev_recv); + netdev_test_set_isr_cb(&netdev, _netdev_isr); /* netdev needs to be set-up */ assert(netdev.netdev.driver); #if LWIP_IPV4 @@ -189,9 +189,9 @@ void _net_init(void) local4.addr = HTONL(_TEST_ADDR4_LOCAL); mask4.addr = HTONL(_TEST_ADDR4_MASK); gw4.addr = HTONL(_TEST_ADDR4_GW); - netif_add(&netif, &local4, &mask4, &gw4, &netdev, lwip_netdev2_init, tcpip_input); + netif_add(&netif, &local4, &mask4, &gw4, &netdev, lwip_netdev_init, tcpip_input); #else - netif_add(&netif, &netdev, lwip_netdev2_init, tcpip_input); + netif_add(&netif, &netdev, lwip_netdev_init, tcpip_input); #endif #if LWIP_IPV6 static const uint8_t local6[] = _TEST_ADDR6_LOCAL; @@ -215,7 +215,7 @@ void _prepare_send_checks(void) mac[4] = mac[6]; mac[5] = mac[7]; - netdev2_test_set_send_cb(&netdev, _netdev_send); + netdev_test_set_send_cb(&netdev, _netdev_send); #if LWIP_ARP const ip4_addr_t remote4 = { .addr = HTONL(_TEST_ADDR4_REMOTE) }; assert(ERR_OK == etharp_add_static_entry(&remote4, (struct eth_addr *)mac)); @@ -249,7 +249,7 @@ bool _inject_4packet(uint32_t src, uint32_t dst, uint8_t proto, void *data, uint8_t *payload = (uint8_t *)(ip_hdr + 1); (void)netif; - _get_addr((netdev2_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); + _get_addr((netdev_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); eth_hdr->type = byteorder_htons(ETHERTYPE_IPV4); IPH_VHL_SET(ip_hdr, 4, 5); IPH_TOS_SET(ip_hdr, 0); @@ -265,7 +265,7 @@ bool _inject_4packet(uint32_t src, uint32_t dst, uint8_t proto, void *data, _netdev_buffer_size = sizeof(ethernet_hdr_t) + sizeof(struct ip_hdr) + data_len; mutex_unlock(&_netdev_buffer_mutex); - ((netdev2_t *)&netdev)->event_callback((netdev2_t *)&netdev, NETDEV2_EVENT_ISR); + ((netdev_t *)&netdev)->event_callback((netdev_t *)&netdev, NETDEV_EVENT_ISR); return true; #else @@ -284,7 +284,7 @@ bool _inject_6packet(const ipv6_addr_t *src, const ipv6_addr_t *dst, uint8_t *payload = (uint8_t *)(ipv6_hdr + 1); (void)netif; - _get_addr((netdev2_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); + _get_addr((netdev_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); eth_hdr->type = byteorder_htons(ETHERTYPE_IPV6); ipv6_hdr_set_version(ipv6_hdr); ipv6_hdr->len = byteorder_htons(data_len); @@ -297,7 +297,7 @@ bool _inject_6packet(const ipv6_addr_t *src, const ipv6_addr_t *dst, _netdev_buffer_size = sizeof(ethernet_hdr_t) + sizeof(ipv6_hdr_t) + data_len; mutex_unlock(&_netdev_buffer_mutex); - ((netdev2_t *)&netdev)->event_callback((netdev2_t *)&netdev, NETDEV2_EVENT_ISR); + ((netdev_t *)&netdev)->event_callback((netdev_t *)&netdev, NETDEV_EVENT_ISR); return true; #else diff --git a/tests/lwip_sock_tcp/Makefile b/tests/lwip_sock_tcp/Makefile index 0414416c8d..d7e57cfcf8 100644 --- a/tests/lwip_sock_tcp/Makefile +++ b/tests/lwip_sock_tcp/Makefile @@ -28,10 +28,10 @@ ifneq (0, $(LWIP_IPV6)) endif USEMODULE += inet_csum -USEMODULE += lwip_ethernet lwip_netdev2 +USEMODULE += lwip_ethernet lwip_netdev USEMODULE += lwip_sock_tcp -USEMODULE += netdev2_eth -USEMODULE += netdev2_test +USEMODULE += netdev_eth +USEMODULE += netdev_test USEMODULE += ps DISABLE_MODULE += auto_init diff --git a/tests/lwip_sock_tcp/README.md b/tests/lwip_sock_tcp/README.md index 513116b6ec..1eb9f2531a 100644 --- a/tests/lwip_sock_tcp/README.md +++ b/tests/lwip_sock_tcp/README.md @@ -2,7 +2,7 @@ Tests for lwIP's sock_tcp port ============================== This tests the `sock_tcp` port of lwIP. There is no network device needed since -a [virtual device](http://doc.riot-os.org/group__sys__netdev2__test.html) is +a [virtual device](http://doc.riot-os.org/group__sys__netdev__test.html) is provided at the backend. These tests test both IPv4 and IPv6 capabilities. They can be activated by diff --git a/tests/lwip_sock_udp/Makefile b/tests/lwip_sock_udp/Makefile index adb0c24036..cc5ae2bb26 100644 --- a/tests/lwip_sock_udp/Makefile +++ b/tests/lwip_sock_udp/Makefile @@ -28,10 +28,10 @@ ifneq (0, $(LWIP_IPV6)) endif USEMODULE += inet_csum -USEMODULE += lwip_ethernet lwip_netdev2 +USEMODULE += lwip_ethernet lwip_netdev USEMODULE += lwip_sock_udp -USEMODULE += netdev2_eth -USEMODULE += netdev2_test +USEMODULE += netdev_eth +USEMODULE += netdev_test USEMODULE += ps DISABLE_MODULE += auto_init diff --git a/tests/lwip_sock_udp/README.md b/tests/lwip_sock_udp/README.md index 102590da1b..b9928eed7b 100644 --- a/tests/lwip_sock_udp/README.md +++ b/tests/lwip_sock_udp/README.md @@ -2,7 +2,7 @@ Tests for lwIP's sock_udp port ============================== This tests the `sock_udp` port of lwIP. There is no network device needed since -a [virtual device](http://doc.riot-os.org/group__sys__netdev2__test.html) is +a [virtual device](http://doc.riot-os.org/group__sys__netdev__test.html) is provided at the backend. These tests test both IPv4 and IPv6 capabilities. They can be activated by diff --git a/tests/lwip_sock_udp/stack.c b/tests/lwip_sock_udp/stack.c index 5c90f6654d..1314f50368 100644 --- a/tests/lwip_sock_udp/stack.c +++ b/tests/lwip_sock_udp/stack.c @@ -17,8 +17,8 @@ #include "msg.h" #include "net/ethernet.h" #include "net/ipv6.h" -#include "net/netdev2/eth.h" -#include "net/netdev2_test.h" +#include "net/netdev/eth.h" +#include "net/netdev_test.h" #include "net/sock.h" #include "net/udp.h" #include "sched.h" @@ -29,7 +29,7 @@ #include "lwip/inet_chksum.h" #include "lwip/nd6.h" #include "lwip/netif.h" -#include "lwip/netif/netdev2.h" +#include "lwip/netif/netdev.h" #include "lwip/opt.h" #include "lwip/tcpip.h" #include "netif/etharp.h" @@ -43,7 +43,7 @@ static msg_t _msg_queue[_MSG_QUEUE_SIZE]; static uint8_t _netdev_buffer[_NETDEV_BUFFER_SIZE]; -netdev2_test_t netdev; +netdev_test_t netdev; static struct netif netif; static kernel_pid_t _check_pid = KERNEL_PID_UNDEF; static mutex_t _netdev_buffer_mutex = MUTEX_INIT; @@ -57,12 +57,12 @@ static inline void _get_iid(uint8_t *iid) iid[0] ^= 0x2; } -static int _get_max_pkt_size(netdev2_t *dev, void *value, size_t max_len) +static int _get_max_pkt_size(netdev_t *dev, void *value, size_t max_len) { - return netdev2_eth_get(dev, NETOPT_MAX_PACKET_SIZE, value, max_len); + return netdev_eth_get(dev, NETOPT_MAX_PACKET_SIZE, value, max_len); } -static int _get_src_len(netdev2_t *dev, void *value, size_t max_len) +static int _get_src_len(netdev_t *dev, void *value, size_t max_len) { uint16_t *v = value; @@ -76,7 +76,7 @@ static int _get_src_len(netdev2_t *dev, void *value, size_t max_len) return sizeof(uint16_t); } -static int _get_addr(netdev2_t *dev, void *value, size_t max_len) +static int _get_addr(netdev_t *dev, void *value, size_t max_len) { uint8_t iid[ETHERNET_ADDR_LEN + 2]; uint8_t *addr = value; @@ -98,17 +98,17 @@ static int _get_addr(netdev2_t *dev, void *value, size_t max_len) return ETHERNET_ADDR_LEN; } -static int _get_addr_len(netdev2_t *dev, void *value, size_t max_len) +static int _get_addr_len(netdev_t *dev, void *value, size_t max_len) { - return netdev2_eth_get(dev, NETOPT_ADDR_LEN, value, max_len); + return netdev_eth_get(dev, NETOPT_ADDR_LEN, value, max_len); } -static int _get_device_type(netdev2_t *dev, void *value, size_t max_len) +static int _get_device_type(netdev_t *dev, void *value, size_t max_len) { - return netdev2_eth_get(dev, NETOPT_DEVICE_TYPE, value, max_len); + return netdev_eth_get(dev, NETOPT_DEVICE_TYPE, value, max_len); } -static int _get_ipv6_iid(netdev2_t *dev, void *value, size_t max_len) +static int _get_ipv6_iid(netdev_t *dev, void *value, size_t max_len) { (void)dev; if (max_len != sizeof(uint64_t)) { @@ -118,12 +118,12 @@ static int _get_ipv6_iid(netdev2_t *dev, void *value, size_t max_len) return sizeof(uint64_t); } -static void _netdev_isr(netdev2_t *dev) +static void _netdev_isr(netdev_t *dev) { - dev->event_callback(dev, NETDEV2_EVENT_RX_COMPLETE); + dev->event_callback(dev, NETDEV_EVENT_RX_COMPLETE); } -static int _netdev_recv(netdev2_t *dev, char *buf, int len, void *info) +static int _netdev_recv(netdev_t *dev, char *buf, int len, void *info) { int res; @@ -142,7 +142,7 @@ static int _netdev_recv(netdev2_t *dev, char *buf, int len, void *info) return res; } -static int _netdev_send(netdev2_t *dev, const struct iovec *vector, int count) +static int _netdev_send(netdev_t *dev, const struct iovec *vector, int count) { msg_t done = { .type = _SEND_DONE }; unsigned offset = 0; @@ -170,21 +170,21 @@ void _net_init(void) msg_init_queue(_msg_queue, _MSG_QUEUE_SIZE); _check_pid = sched_active_pid; - netdev2_test_setup(&netdev, NULL); - netdev2_test_set_get_cb(&netdev, NETOPT_SRC_LEN, _get_src_len); - netdev2_test_set_get_cb(&netdev, NETOPT_MAX_PACKET_SIZE, + netdev_test_setup(&netdev, NULL); + netdev_test_set_get_cb(&netdev, NETOPT_SRC_LEN, _get_src_len); + netdev_test_set_get_cb(&netdev, NETOPT_MAX_PACKET_SIZE, _get_max_pkt_size); - netdev2_test_set_get_cb(&netdev, NETOPT_ADDRESS, _get_addr); - netdev2_test_set_get_cb(&netdev, NETOPT_ADDR_LEN, + netdev_test_set_get_cb(&netdev, NETOPT_ADDRESS, _get_addr); + netdev_test_set_get_cb(&netdev, NETOPT_ADDR_LEN, _get_addr_len); - netdev2_test_set_get_cb(&netdev, NETOPT_SRC_LEN, + netdev_test_set_get_cb(&netdev, NETOPT_SRC_LEN, _get_addr_len); - netdev2_test_set_get_cb(&netdev, NETOPT_DEVICE_TYPE, + netdev_test_set_get_cb(&netdev, NETOPT_DEVICE_TYPE, _get_device_type); - netdev2_test_set_get_cb(&netdev, NETOPT_IPV6_IID, + netdev_test_set_get_cb(&netdev, NETOPT_IPV6_IID, _get_ipv6_iid); - netdev2_test_set_recv_cb(&netdev, _netdev_recv); - netdev2_test_set_isr_cb(&netdev, _netdev_isr); + netdev_test_set_recv_cb(&netdev, _netdev_recv); + netdev_test_set_isr_cb(&netdev, _netdev_isr); /* netdev needs to be set-up */ assert(netdev.netdev.driver); #if LWIP_IPV4 @@ -192,9 +192,9 @@ void _net_init(void) local4.addr = HTONL(_TEST_ADDR4_LOCAL); mask4.addr = HTONL(_TEST_ADDR4_MASK); gw4.addr = HTONL(_TEST_ADDR4_GW); - netif_add(&netif, &local4, &mask4, &gw4, &netdev, lwip_netdev2_init, tcpip_input); + netif_add(&netif, &local4, &mask4, &gw4, &netdev, lwip_netdev_init, tcpip_input); #else - netif_add(&netif, &netdev, lwip_netdev2_init, tcpip_input); + netif_add(&netif, &netdev, lwip_netdev_init, tcpip_input); #endif #if LWIP_IPV6 static const uint8_t local6[] = _TEST_ADDR6_LOCAL; @@ -218,7 +218,7 @@ void _prepare_send_checks(void) mac[4] = mac[6]; mac[5] = mac[7]; - netdev2_test_set_send_cb(&netdev, _netdev_send); + netdev_test_set_send_cb(&netdev, _netdev_send); #if LWIP_ARP const ip4_addr_t remote4 = { .addr = HTONL(_TEST_ADDR4_REMOTE) }; assert(ERR_OK == etharp_add_static_entry(&remote4, (struct eth_addr *)mac)); @@ -255,7 +255,7 @@ bool _inject_4packet(uint32_t src, uint32_t dst, uint16_t src_port, const uint16_t udp_len = (uint16_t)(sizeof(udp_hdr_t) + data_len); (void)netif; - _get_addr((netdev2_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); + _get_addr((netdev_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); eth_hdr->type = byteorder_htons(ETHERTYPE_IPV4); IPH_VHL_SET(ip_hdr, 4, 5); IPH_TOS_SET(ip_hdr, 0); @@ -277,7 +277,7 @@ bool _inject_4packet(uint32_t src, uint32_t dst, uint16_t src_port, _netdev_buffer_size = sizeof(ethernet_hdr_t) + sizeof(struct ip_hdr) + sizeof(udp_hdr_t) + data_len; mutex_unlock(&_netdev_buffer_mutex); - ((netdev2_t *)&netdev)->event_callback((netdev2_t *)&netdev, NETDEV2_EVENT_ISR); + ((netdev_t *)&netdev)->event_callback((netdev_t *)&netdev, NETDEV_EVENT_ISR); return true; #else @@ -301,7 +301,7 @@ bool _inject_6packet(const ipv6_addr_t *src, const ipv6_addr_t *dst, uint16_t csum = 0; (void)netif; - _get_addr((netdev2_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); + _get_addr((netdev_t *)&netdev, ð_hdr->dst, sizeof(eth_hdr->dst)); eth_hdr->type = byteorder_htons(ETHERTYPE_IPV6); ipv6_hdr_set_version(ipv6_hdr); ipv6_hdr->len = byteorder_htons(udp_len); @@ -326,7 +326,7 @@ bool _inject_6packet(const ipv6_addr_t *src, const ipv6_addr_t *dst, _netdev_buffer_size = sizeof(ethernet_hdr_t) + sizeof(ipv6_hdr_t) + sizeof(udp_hdr_t) + data_len; mutex_unlock(&_netdev_buffer_mutex); - ((netdev2_t *)&netdev)->event_callback((netdev2_t *)&netdev, NETDEV2_EVENT_ISR); + ((netdev_t *)&netdev)->event_callback((netdev_t *)&netdev, NETDEV_EVENT_ISR); return true; #else diff --git a/tests/netdev2_test/Makefile b/tests/netdev_test/Makefile similarity index 80% rename from tests/netdev2_test/Makefile rename to tests/netdev_test/Makefile index e6f21b1002..655f87caa8 100644 --- a/tests/netdev2_test/Makefile +++ b/tests/netdev_test/Makefile @@ -1,4 +1,4 @@ -APPLICATION = netdev2_test +APPLICATION = netdev_test include ../Makefile.tests_common BOARD_INSUFFICIENT_MEMORY := nucleo32-f031 @@ -10,8 +10,8 @@ FEATURES_REQUIRED += periph_timer # xtimer required for this application USEMODULE += gnrc USEMODULE += gnrc_neterr USEMODULE += gnrc_netif -USEMODULE += gnrc_netdev2 -USEMODULE += netdev2_test +USEMODULE += gnrc_netdev +USEMODULE += netdev_test USEMODULE += od CFLAGS += -DGNRC_PKTBUF_SIZE=200 diff --git a/tests/netdev2_test/main.c b/tests/netdev_test/main.c similarity index 87% rename from tests/netdev2_test/main.c rename to tests/netdev_test/main.c index 53899d459f..ff9ee3f4e8 100644 --- a/tests/netdev2_test/main.c +++ b/tests/netdev_test/main.c @@ -10,7 +10,7 @@ * @{ * * @file - * @brief Show case application for netdev2_test + * @brief Show case application for netdev_test * * @author Martine Lenders * @@ -22,8 +22,8 @@ #include "msg.h" #include "net/ethernet.h" #include "net/gnrc.h" -#include "net/gnrc/netdev2/eth.h" -#include "net/netdev2_test.h" +#include "net/gnrc/netdev/eth.h" +#include "net/netdev_test.h" #include "od.h" #include "thread.h" #include "utlist.h" @@ -53,18 +53,18 @@ static const uint8_t _test_dst[] = { 0xf5, 0x19, 0x9a, 0x1d, 0xd8, 0x8f }; static const uint8_t _test_src[] = { 0x41, 0x9b, 0x9f, 0x56, 0x36, 0x46 }; static char _mac_stack[_MAC_STACKSIZE]; -static gnrc_netdev2_t _gnrc_dev; -static netdev2_test_t _dev; +static gnrc_netdev_t _gnrc_dev; +static netdev_test_t _dev; static msg_t _main_msg_queue[_MAIN_MSG_QUEUE_SIZE]; static uint8_t _tmp[_EXP_LENGTH]; static kernel_pid_t _mac_pid; static uint8_t _tmp_len = 0; -static void _dev_isr(netdev2_t *dev); -static int _dev_recv(netdev2_t *dev, char *buf, int len, void *info); -static int _dev_send(netdev2_t *dev, const struct iovec *vector, int count); -static int _dev_get_addr(netdev2_t *dev, void *value, size_t max_len); -static int _dev_set_addr(netdev2_t *dev, void *value, size_t max_len); +static void _dev_isr(netdev_t *dev); +static int _dev_recv(netdev_t *dev, char *buf, int len, void *info); +static int _dev_send(netdev_t *dev, const struct iovec *vector, int count); +static int _dev_get_addr(netdev_t *dev, void *value, size_t max_len); +static int _dev_set_addr(netdev_t *dev, void *value, size_t max_len); /* tests getter */ static int test_get_addr(void) @@ -153,7 +153,7 @@ static int test_receive(void) /* register for GNRC_NETTYPE_UNDEF */ gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &me); /* fire ISR event */ - _dev.netdev.event_callback((netdev2_t *)&_dev.netdev, NETDEV2_EVENT_ISR); + _dev.netdev.event_callback((netdev_t *)&_dev.netdev, NETDEV_EVENT_ISR); /* wait for packet from MAC layer*/ msg_receive(&msg); /* check message */ @@ -259,15 +259,15 @@ int main(void) /* initialization */ gnrc_pktbuf_init(); msg_init_queue(_main_msg_queue, _MAIN_MSG_QUEUE_SIZE); - netdev2_test_setup(&_dev, NULL); - netdev2_test_set_isr_cb(&_dev, _dev_isr); - netdev2_test_set_recv_cb(&_dev, _dev_recv); - netdev2_test_set_send_cb(&_dev, _dev_send); - netdev2_test_set_get_cb(&_dev, NETOPT_ADDRESS, _dev_get_addr); - netdev2_test_set_set_cb(&_dev, NETOPT_ADDRESS, _dev_set_addr); - gnrc_netdev2_eth_init(&_gnrc_dev, (netdev2_t *)(&_dev)); - _mac_pid = gnrc_netdev2_init(_mac_stack, _MAC_STACKSIZE, _MAC_PRIO, - "gnrc_netdev_eth_test", &_gnrc_dev); + netdev_test_setup(&_dev, NULL); + netdev_test_set_isr_cb(&_dev, _dev_isr); + netdev_test_set_recv_cb(&_dev, _dev_recv); + netdev_test_set_send_cb(&_dev, _dev_send); + netdev_test_set_get_cb(&_dev, NETOPT_ADDRESS, _dev_get_addr); + netdev_test_set_set_cb(&_dev, NETOPT_ADDRESS, _dev_set_addr); + gnrc_netdev_eth_init(&_gnrc_dev, (netdev_t *)(&_dev)); + _mac_pid = gnrc_netdev_init(_mac_stack, _MAC_STACKSIZE, _MAC_PRIO, + "gnrc_netdev_eth_test", &_gnrc_dev); if (_mac_pid <= KERNEL_PID_UNDEF) { puts("Could not start MAC thread\n"); return 1; @@ -283,16 +283,16 @@ int main(void) return 0; } -/* netdev2_test callbacks */ -static void _dev_isr(netdev2_t *dev) +/* netdev_test callbacks */ +static void _dev_isr(netdev_t *dev) { (void)dev; if (dev->event_callback) { - dev->event_callback(dev, NETDEV2_EVENT_RX_COMPLETE); + dev->event_callback(dev, NETDEV_EVENT_RX_COMPLETE); } } -static int _dev_recv(netdev2_t *dev, char *buf, int len, void *info) +static int _dev_recv(netdev_t *dev, char *buf, int len, void *info) { (void)dev; (void)info; @@ -308,7 +308,7 @@ static int _dev_recv(netdev2_t *dev, char *buf, int len, void *info) } } -static int _dev_send(netdev2_t *dev, const struct iovec *vector, int count) +static int _dev_send(netdev_t *dev, const struct iovec *vector, int count) { int idx = 0; @@ -337,7 +337,7 @@ static int _dev_send(netdev2_t *dev, const struct iovec *vector, int count) return idx; } -static int _dev_get_addr(netdev2_t *dev, void *value, size_t max_len) +static int _dev_get_addr(netdev_t *dev, void *value, size_t max_len) { (void)dev; if (max_len < sizeof(_dev_addr)) { @@ -347,7 +347,7 @@ static int _dev_get_addr(netdev2_t *dev, void *value, size_t max_len) return sizeof(_dev_addr); } -static int _dev_set_addr(netdev2_t *dev, void *value, size_t value_len) +static int _dev_set_addr(netdev_t *dev, void *value, size_t value_len) { (void)dev; if (value_len != sizeof(_dev_addr)) {