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 "\<drivers_netdev_netdev\>" | \
        xargs sed -i "s/\<drivers_netdev_netdev\>/drivers_netdev_api/g"
git add -p
git commit --amend
```
This commit is contained in:
Martine Lenders 2017-02-15 13:07:34 +01:00
parent 2e304bcd17
commit 29842bb5e4
137 changed files with 1556 additions and 1750 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,3 +1,3 @@
ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE)))
USEMODULE += netdev2_tap
USEMODULE += netdev_tap
endif

View File

@ -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

View File

@ -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

View File

@ -25,8 +25,8 @@
#include <stdbool.h>
#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;

View File

@ -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
}

View File

@ -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;

View File

@ -22,7 +22,7 @@
#include <errno.h>
#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);

View File

@ -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

View File

@ -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

View File

@ -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 <kaspar@schleiser.de>
*/
#ifndef NETDEV2_TAP_H
#define NETDEV2_TAP_H
#ifndef NETDEV_TAP_H
#define NETDEV_TAP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#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 */

View File

@ -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 <m.lenders@fu-berlin.de>
*/
#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_ */
/** @} */

View File

@ -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"

View File

@ -10,7 +10,7 @@
*/
/*
* @ingroup netdev2
* @ingroup netdev
* @{
* @brief Low-level ethernet driver for tap interfaces
* @author Kaspar Schleiser <kaspar@schleiser.de>
@ -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) {

View File

@ -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(" <tap interface %d>", 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

View File

@ -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

View File

@ -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
}

View File

@ -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,

View File

@ -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);
}

View File

@ -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:

View File

@ -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

View File

@ -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 @@
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="0.9" />
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="1" />
</linearGradient>
<linearGradient id="outer-gradient-netdev2" x1="0%" y1="0%" x2="0%" y2="100%">
<linearGradient id="outer-gradient-netdev" x1="0%" y1="0%" x2="0%" y2="100%">
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="0" />
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="0.1" />
<stop style="stop-color: #3fa687; stop-opacity: 0;" offset="0.9" />
@ -494,7 +494,7 @@
<g id="transformer" transform="scale(0.75)">
<g id="gnrc-detail" transform="translate(5,0)">
<rect id="gnrc-detail-conn" x="0" y="0" rx="4" ry="4" width="380" height="30" />
<rect id="gnrc-detail-netdev2" x="0" y="360" rx="4" ry="4" width="380" height="30" />
<rect id="gnrc-detail-netdev" x="0" y="360" rx="4" ry="4" width="380" height="30" />
<g id="gnrc-detail-gnrc" transform="translate(0,10)">
<rect id="sys-net-border" class="outer-stroke" x="0" y="30" rx="4" ry="4"
width="380" height="310" />
@ -547,9 +547,9 @@
<text id="gnrc-ipv6-label" class="modbox-text"
x="190" y="192"><tspan>gnrc_ipv6</tspan></text>
</g>
<g id="netapi-ipv6-netdev2">
<path id="netapi-ipv6-netdev2-arrow" d="m 97.5,215 0,100" class="outer-stroke-arrow" />
<text id="netapi-ipv6-netdev2-label" class="outer-text-netapi"
<g id="netapi-ipv6-netdev">
<path id="netapi-ipv6-netdev-arrow" d="m 97.5,215 0,100" class="outer-stroke-arrow" />
<text id="netapi-ipv6-netdev-label" class="outer-text-netapi"
x="104" y="272"><tspan>netapi</tspan></text>
</g>
<g id="netapi-ipv6-6lo">
@ -563,12 +563,12 @@
<text id="gnrc-6lo-label" class="modbox-text"
x="282.5" y="272"><tspan>gnrc_sixlowpan</tspan></text>
</g>
<g id="netapi-6lo-netdev2">
<path id="netapi-6lo-netdev2-arrow" d="m 282.5,295 0,20" class="outer-stroke-arrow" />
<text id="netapi-6lo-netdev2-label" class="outer-text-netapi"
<g id="netapi-6lo-netdev">
<path id="netapi-6lo-netdev-arrow" d="m 282.5,295 0,20" class="outer-stroke-arrow" />
<text id="netapi-6lo-netdev-label" class="outer-text-netapi"
x="289" y="311"><tspan>netapi</tspan></text>
</g>
<g id="gnrc-netdev2-ipv6">
<g id="gnrc-netdev-ipv6">
<rect id="gnrc-udp-box" class="modbox" x="10" y="320" rx="4" ry="4"
width="175" height="50" />
<text id="gnrc-udp-label" class="modbox-text"
@ -578,7 +578,7 @@
<rect id="gnrc-6lo-box" class="modbox" x="195" y="320" rx="4" ry="4"
width="175" height="50" />
<text id="gnrc-6lo-label" class="modbox-text"
x="282.5" y="352"><tspan>gnrc_netdev2</tspan></text>
x="282.5" y="352"><tspan>gnrc_netdev</tspan></text>
</g>
</g>
</g>

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -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 @@
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="0.9" />
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="1" />
</linearGradient>
<linearGradient id="outer-gradient-netdev2" x1="0%" y1="0%" x2="0%" y2="100%">
<linearGradient id="outer-gradient-netdev" x1="0%" y1="0%" x2="0%" y2="100%">
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="0" />
<stop style="stop-color: #3fa687; stop-opacity: 1;" offset="0.1" />
<stop style="stop-color: #3fa687; stop-opacity: 0;" offset="0.9" />

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -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