diff --git a/CODEOWNERS b/CODEOWNERS index 0ef20a1d49..7986045e8b 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -129,7 +129,6 @@ /tests/ @smlng @leandrolanzieri @aabadie @MichelRottleuthner @fjmolinas /tests/candev/ @wosym -/tests/emb6* @miri64 /tests/gnrc* @miri64 /tests/lwip* @miri64 /tests/slip/ @miri64 diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index fa6f4cdc9a..be3ef61738 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -19,7 +19,6 @@ PSEUDOMODULES += crypto_% # crypto_aes or crypto_3des PSEUDOMODULES += devfs_% PSEUDOMODULES += dhcpv6_% PSEUDOMODULES += ecc_% -PSEUDOMODULES += emb6_router PSEUDOMODULES += event_% PSEUDOMODULES += fmt_% PSEUDOMODULES += gnrc_dhcpv6_% diff --git a/pkg/emb6/Makefile b/pkg/emb6/Makefile deleted file mode 100644 index 95e133e5f8..0000000000 --- a/pkg/emb6/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -PKG_NAME=emb6 -PKG_URL=https://github.com/hso-esk/emb6.git -PKG_VERSION=14e4a3cfff01644e078870e14e16a1fe60dcc895 -PKG_LICENSE=BSD-3-Clause - -include $(RIOTBASE)/pkg/pkg.mk - -# GCC 7.x fails on (intentional) fallthrough, thus disable implicit-fallthrough. -CFLAGS += -Wno-implicit-fallthrough -CFLAGS += -Wno-strict-aliasing -CFLAGS += -Wno-old-style-definition -CFLAGS += -Wno-strict-prototypes - -# Collect all chosen sub-modules but not the pseudo-modules and the ones -# implemented in ./contrib/ -EMB6_SUBMODULES:=$(filter-out emb6_contrib \ - emb6_netdev \ - emb6_router \ - emb6_sock_%,$(filter emb6_%,$(USEMODULE))) - -all: $(EMB6_SUBMODULES) - "$(MAKE)" -C $(PKG_SOURCE_DIR) - -# Rule for all submodules -emb6_%: - "$(MAKE)" -C $(dir $(shell grep -lR "MODULE.*=.*\<$@\>" $(PKG_SOURCE_DIR))) - -ifeq (llvm,$(TOOLCHAIN)) - CFLAGS += -Wno-tautological-compare - CFLAGS += -Wno-parentheses-equality -endif diff --git a/pkg/emb6/Makefile.dep b/pkg/emb6/Makefile.dep deleted file mode 100644 index bd033e4534..0000000000 --- a/pkg/emb6/Makefile.dep +++ /dev/null @@ -1,24 +0,0 @@ -ifneq (,$(filter emb6_sock_%,$(USEMODULE))) - USEMODULE += core_mbox - USEMODULE += emb6_sock -endif - -ifneq (,$(filter emb6_%,$(USEMODULE))) - USEMODULE += emb6 -endif - -ifneq (,$(filter emb6,$(USEMODULE))) - USEPKG += emb6 - USEMODULE += emb6_bsp - USEMODULE += emb6_common - USEMODULE += emb6_contrib - USEMODULE += emb6_ipv6 - USEMODULE += emb6_ipv6_multicast - USEMODULE += emb6_llsec - USEMODULE += emb6_mac - USEMODULE += emb6_netdev - USEMODULE += emb6_rpl - USEMODULE += emb6_sicslowpan - USEMODULE += emb6_utils - USEMODULE += xtimer -endif diff --git a/pkg/emb6/Makefile.include b/pkg/emb6/Makefile.include deleted file mode 100644 index 04e7bdf431..0000000000 --- a/pkg/emb6/Makefile.include +++ /dev/null @@ -1,35 +0,0 @@ -PKG_BUILDDIR ?= $(PKGDIRBASE)/emb6 -EMB6_DIR := $(PKG_BUILDDIR) -EMB6_CONTRIB := $(RIOTBASE)/pkg/emb6/contrib - -INCLUDES += -I$(PKG_BUILDDIR)/target -INCLUDES += -I$(RIOTBASE)/pkg/emb6/include -INCLUDES += -I$(EMB6_DIR)/emb6 -INCLUDES += -I$(EMB6_DIR)/emb6/inc/net/ipv6 -INCLUDES += -I$(EMB6_DIR)/emb6/inc/net/ipv6/multicast -INCLUDES += -I$(EMB6_DIR)/emb6/inc/mac/llsec -INCLUDES += -I$(EMB6_DIR)/emb6/inc/mac -INCLUDES += -I$(EMB6_DIR)/emb6/inc/net/rpl -INCLUDES += -I$(EMB6_DIR)/emb6/inc/net/sicslowpan -INCLUDES += -I$(EMB6_DIR)/emb6/inc/tport -INCLUDES += -I$(EMB6_DIR)/utils/inc - -CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wno-type-limits -CFLAGS += -Wno-sign-compare -Wno-missing-field-initializers - -ifeq (,$(filter emb6_router,$(USEMODULE))) - CFLAGS += -DEMB6_CONF_ROUTER=FALSE -endif - -ifneq (,$(filter emb6_contrib,$(USEMODULE))) - DIRS += $(EMB6_CONTRIB) -endif - -ifneq (,$(filter emb6_netdev,$(USEMODULE))) - DIRS += $(EMB6_CONTRIB)/netdev -endif - -ifneq (,$(filter emb6_sock_udp,$(USEMODULE))) - DIRS += $(EMB6_CONTRIB)/sock/udp - CFLAGS += -DSOCK_HAS_IPV6 -endif diff --git a/pkg/emb6/contrib/Makefile b/pkg/emb6/contrib/Makefile deleted file mode 100644 index 600b0c807b..0000000000 --- a/pkg/emb6/contrib/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -MODULE = emb6_contrib - -include $(RIOTBASE)/Makefile.base diff --git a/pkg/emb6/contrib/board_conf.c b/pkg/emb6/contrib/board_conf.c deleted file mode 100644 index d63ba134f1..0000000000 --- a/pkg/emb6/contrib/board_conf.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 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. - */ - -/** - * @{ - * - * @file - * @author Martine Lenders - */ - -#include "emb6/netdev.h" - -#include "etimer.h" -#include "board_conf.h" - -#define ENABLE_DEBUG (0) -#include "debug.h" - -uint8_t board_conf(s_ns_t *ps_nStack) -{ - if (ps_nStack != NULL) { - ps_nStack->inif = &emb6_netdev_driver; - etimer_init(); - return ps_nStack->inif->init(ps_nStack); - } - else { - DEBUG("Network stack pointer is NULL"); - return 0; - } -} - -/** @} */ diff --git a/pkg/emb6/contrib/netdev/Makefile b/pkg/emb6/contrib/netdev/Makefile deleted file mode 100644 index e8dd709650..0000000000 --- a/pkg/emb6/contrib/netdev/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -MODULE = emb6_netdev - -include $(RIOTBASE)/Makefile.base diff --git a/pkg/emb6/contrib/netdev/emb6_netdev.c b/pkg/emb6/contrib/netdev/emb6_netdev.c deleted file mode 100644 index ded613a650..0000000000 --- a/pkg/emb6/contrib/netdev/emb6_netdev.c +++ /dev/null @@ -1,217 +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. - */ - -/** - * @{ - * - * @file - * @author Martine Lenders - */ - -#include -#include -#include - -#include "msg.h" -#include "net/netdev.h" - -#include "evproc.h" -#include "emb6.h" -#include "linkaddr.h" -#include "packetbuf.h" - -#define ENABLE_DEBUG (0) -#include "debug.h" - -extern uip_lladdr_t uip_lladdr; - -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 _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_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 = &_netdev_set_promisc, -}; - -static void _get_recv_pkt(void) -{ - char *dataptr; - struct netdev_radio_rx_info rx_info; - int8_t len; - - packetbuf_clear(); - - dataptr = packetbuf_dataptr(); - len = _dev->driver->recv(_dev, dataptr, PACKETBUF_SIZE, &rx_info); - _last_rssi = rx_info.rssi; - - if ((len > 0) && (_lowmac != NULL)) { - packetbuf_set_datalen(len); - _lowmac->input(); - } -} - -static void _event_cb(netdev_t *dev, netdev_event_t event) -{ - if (event == NETDEV_EVENT_ISR) { - /* EVENT_TYPE_PCK_LL is supposed to be used by drivers, so use it - * (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 NETDEV_EVENT_RX_COMPLETE: { - _get_recv_pkt(); - } - break; - default: - break; - } - } -} - -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) { - _dev->driver->isr(_dev); - } -} - -static void _configure_netdev(void) -{ - /* Enable RX-complete interrupts */ - static const netopt_enable_t enable = NETOPT_ENABLE; - int res = _dev->driver->set(_dev, NETOPT_RX_END_IRQ, &enable, sizeof(enable)); - if (res < 0) { - DEBUG("emb6: enable NETOPT_RX_END_IRQ failed: %d\n", res); - } -} - -int emb6_netdev_setup(netdev_t *dev) -{ - if (_dev == NULL) { - _dev = dev; - return 0; - } - return -1; -} - -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; - _dev->driver->get(_dev, NETOPT_ADDRESS_LONG, &mac_phy_config.mac_address, - sizeof(mac_phy_config.mac_address)); - memcpy(&uip_lladdr, mac_phy_config.mac_address, - sizeof(mac_phy_config.mac_address)); - _dev->driver->get(_dev, NETOPT_NID, &mac_phy_config.pan_id, - sizeof(mac_phy_config.pan_id)); - _configure_netdev(); - linkaddr_set_node_addr((linkaddr_t *)&uip_lladdr); - _lowmac = p_ns->lmac; - evproc_regCallback(EVENT_TYPE_PCK_LL, _emb6_netdev_callback); - return 1; - } - return 0; -} - -static int8_t _netdev_send(const void *pr_payload, uint8_t c_len) -{ - if (_dev != NULL) { - iolist_t iolist = { - .iol_base = (void *)pr_payload, - .iol_len = c_len, - }; - if (_dev->driver->send(_dev, &iolist) < 0) { - DEBUG("Error on send\n"); - return RADIO_TX_ERR; - } - DEBUG("Packet of length %u was transmitted\n", (unsigned)c_len); - return RADIO_TX_OK; - } - DEBUG("Device was not initialized\n"); - return RADIO_TX_ERR; -} - -static int8_t _netdev_on(void) -{ - /* TODO: turn netdev on */ - return 1; -} - -static int8_t _netdev_off(void) -{ - /* TODO: turn netdev off */ - return 1; -} - -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 _netdev_get_txpower(void) -{ - int16_t power = 0; - - _dev->driver->get(_dev, NETOPT_TX_POWER, &power, sizeof(power)); - return (int8_t)power; -} - -static void _netdev_set_sensitivity(int8_t sens) -{ - /* TODO: set sensitivity */ -} - -static int8_t _netdev_get_sensitivity(void) -{ - /* TODO: get sensitivity */ - return 0; -} - -static int8_t _netdev_get_rssi(void) -{ - return (int8_t)(_rssi_base_value + 1.03 * _last_rssi); -} - -static void _netdev_set_promisc(uint8_t c_on_off) -{ - netopt_enable_t en = (c_on_off) ? NETOPT_ENABLE : NETOPT_DISABLE; - - _dev->driver->set(_dev, NETOPT_PROMISCUOUSMODE, &en, sizeof(en)); -} - -/** @} */ diff --git a/pkg/emb6/contrib/sock/udp/Makefile b/pkg/emb6/contrib/sock/udp/Makefile deleted file mode 100644 index d38d86d7ac..0000000000 --- a/pkg/emb6/contrib/sock/udp/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -MODULE := emb6_sock_udp - -include $(RIOTBASE)/Makefile.base diff --git a/pkg/emb6/contrib/sock/udp/emb6_sock_udp.c b/pkg/emb6/contrib/sock/udp/emb6_sock_udp.c deleted file mode 100644 index 433b1d813d..0000000000 --- a/pkg/emb6/contrib/sock/udp/emb6_sock_udp.c +++ /dev/null @@ -1,325 +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. - */ - -/** - * @{ - * - * @file - * @author Martine Lenders - */ - -#include -#include -#include - -#include "byteorder.h" -#include "evproc.h" -#include "msg.h" -#include "mutex.h" -#include "net/af.h" -#include "net/sock/udp.h" -#include "net/ipv6/hdr.h" -#include "sched.h" -#include "uip.h" -#include "xtimer.h" - -#define _MSG_TYPE_CLOSE (0x4123) -#define _MSG_TYPE_TIMEOUT (0x4124) -#define _MSG_TYPE_RCV (0x4125) - -/* struct to describe a sendto command for emb6 thread */ -typedef struct { - mutex_t block; - struct udp_socket *sock; - const sock_udp_ep_t *remote; - int res; - const void *data; - size_t len; -} _send_cmd_t; - -extern uint16_t uip_slen; - -static bool send_registered = false; - -static void _timeout_callback(void *arg); -static void _input_callback(struct udp_socket *c, void *ptr, - const uip_ipaddr_t *src_addr, uint16_t src_port, - const uip_ipaddr_t *dst_addr, uint16_t dst_port, - const uint8_t *data, uint16_t datalen); -static void _output_callback(c_event_t c_event, p_data_t p_data); - -static int _reg(struct udp_socket *c, void *ptr, udp_socket_input_callback_t cb, - const sock_udp_ep_t *local, const sock_udp_ep_t *remote) -{ - if (((local != NULL) && (local->family != AF_INET6)) || - ((remote != NULL) && (remote->family != AF_INET6))) { - return -EAFNOSUPPORT; - } - if (udp_socket_register(c, ptr, cb) < 0) { - return -ENOMEM; - } - if (local != NULL) { - if (udp_socket_bind(c, local->port) < 0) { - udp_socket_close(c); - return -EADDRINUSE; - } - } - if (remote != NULL) { - /* check of return value not necessary, since neither c nor - * c->udp_conn is NULL (only error case) at this point */ - udp_socket_connect(c, (uip_ipaddr_t *)&remote->addr, remote->port); - } - return 0; -} - -int sock_udp_create(sock_udp_t *sock, const sock_udp_ep_t *local, - const sock_udp_ep_t *remote, uint16_t flags) -{ - int res; - - (void)flags; - assert((sock != NULL)); - assert((remote == NULL) || (remote->port != 0)); - if (sock->sock.input_callback != NULL) { - sock_udp_close(sock); - } - mutex_init(&sock->mutex); - mutex_lock(&sock->mutex); - mbox_init(&sock->mbox, sock->mbox_queue, SOCK_MBOX_SIZE); - atomic_init(&sock->receivers, 0); - if ((res = _reg(&sock->sock, sock, _input_callback, local, remote)) < 0) { - sock->sock.input_callback = NULL; - } - mutex_unlock(&sock->mutex); - return res; -} - -void sock_udp_close(sock_udp_t *sock) -{ - assert(sock != NULL); - if (sock->sock.input_callback != NULL) { - while (atomic_fetch_sub(&sock->receivers, 1) > 0) { - msg_t msg = { .type = _MSG_TYPE_CLOSE }; - mbox_put(&sock->mbox, &msg); - } - mutex_lock(&sock->mutex); - udp_socket_close(&sock->sock); - sock->sock.input_callback = NULL; - mutex_unlock(&sock->mutex); - } -} - -int sock_udp_get_local(sock_udp_t *sock, sock_udp_ep_t *ep) -{ - assert((sock != NULL) && (ep != NULL)); - if ((sock->sock.input_callback != NULL) && - (sock->sock.udp_conn->lport != 0)) { - mutex_lock(&sock->mutex); - /* local UDP endpoints do not have addresses in emb6 */ - memset(&ep->addr, 0, sizeof(ipv6_addr_t)); - ep->port = ntohs(sock->sock.udp_conn->lport); - mutex_unlock(&sock->mutex); - return sizeof(ipv6_addr_t); - } - return -EADDRNOTAVAIL; -} - -int sock_udp_get_remote(sock_udp_t *sock, sock_udp_ep_t *ep) -{ - assert((sock != NULL) && (ep != NULL)); - if ((sock->sock.input_callback != NULL) && - (sock->sock.udp_conn->rport != 0)) { - mutex_lock(&sock->mutex); - memcpy(&ep->addr, &sock->sock.udp_conn->ripaddr, sizeof(ipv6_addr_t)); - ep->port = ntohs(sock->sock.udp_conn->rport); - mutex_unlock(&sock->mutex); - return sizeof(ipv6_addr_t); - } - return -ENOTCONN; -} - -int sock_udp_recv(sock_udp_t *sock, void *data, size_t max_len, - uint32_t timeout, sock_udp_ep_t *remote) -{ - xtimer_t timeout_timer; - int blocking = BLOCKING; - int res = -EIO; - msg_t msg; - - assert((sock != NULL) && (data != NULL) && (max_len > 0)); - if (sock->sock.input_callback == NULL) { - return -EADDRNOTAVAIL; - } - if (timeout == 0) { - blocking = NON_BLOCKING; - } - else if (timeout != SOCK_NO_TIMEOUT) { - timeout_timer.callback = _timeout_callback; - timeout_timer.arg = &sock->mbox; - xtimer_set(&timeout_timer, timeout); - } - atomic_fetch_add(&sock->receivers, 1); - if (_mbox_get(&sock->mbox, &msg, blocking) == 0) { - /* do not need to remove xtimer, since we only get here in non-blocking - * mode (timeout > 0) */ - return -EAGAIN; - } - switch (msg.type) { - case _MSG_TYPE_CLOSE: - res = -EADDRNOTAVAIL; - break; - case _MSG_TYPE_TIMEOUT: - res = -ETIMEDOUT; - break; - case _MSG_TYPE_RCV: - mutex_lock(&sock->mutex); - if (max_len < sock->recv_info.datalen) { - res = -ENOBUFS; - mutex_unlock(&sock->mutex); - break; - } - memcpy(data, sock->recv_info.data, sock->recv_info.datalen); - if (remote != NULL) { - remote->family = AF_INET6; - remote->netif = SOCK_ADDR_ANY_NETIF; - memcpy(&remote->addr, sock->recv_info.src, sizeof(ipv6_addr_t)); - remote->port = sock->recv_info.src_port; - } - res = (int)sock->recv_info.datalen; - mutex_unlock(&sock->mutex); - break; - } - atomic_fetch_sub(&sock->receivers, 1); - return res; -} - -int sock_udp_send(sock_udp_t *sock, const void *data, size_t len, - const sock_udp_ep_t *remote) -{ - struct udp_socket tmp; - _send_cmd_t send_cmd = { .block = MUTEX_INIT, - .remote = remote, - .data = data, - .len = len }; - - assert((sock != NULL) || (remote != NULL)); - assert((len == 0) || (data != NULL)); /* (len != 0) => (data != NULL) */ - /* we want the send in the uip thread (which udp_socket_send does not offer) - * so we need to do it manually */ - if (!send_registered) { - if (evproc_regCallback(EVENT_TYPE_SOCK_SEND, _output_callback) != E_SUCCESS) { - return -ENOMEM; - } - else { - send_registered = true; - } - } - if ((len > (UIP_BUFSIZE - (UIP_LLH_LEN + UIP_IPUDPH_LEN))) || - (len > UINT16_MAX)) { - return -ENOMEM; - } - if (remote != NULL) { - if (remote->family != AF_INET6) { - return -EAFNOSUPPORT; - } - if (remote->port == 0) { - return -EINVAL; - } - send_cmd.remote = remote; - } - else if (sock->sock.udp_conn->rport == 0) { - return -ENOTCONN; - } - /* cppcheck-suppress nullPointerRedundantCheck - * (reason: remote == NULL implies that sock != NULL (see assert at start of - * function) * that's why it is okay in the if-statement above to check - * sock->... without checking (sock != NULL) first => this check afterwards - * isn't redundant) */ - if (sock == NULL) { - int res; - if ((res = _reg(&tmp, NULL, NULL, NULL, NULL)) < 0) { - return res; - } - send_cmd.sock = &tmp; - } - else { - send_cmd.sock = &sock->sock; - } - mutex_lock(&send_cmd.block); - /* change to emb6 thread context */ - if (evproc_putEvent(E_EVPROC_TAIL, EVENT_TYPE_SOCK_SEND, &send_cmd) == E_SUCCESS) { - /* block thread until data was sent */ - mutex_lock(&send_cmd.block); - } - else { - /* most likely error: event queue was full */ - send_cmd.res = -ENOMEM; - } - if (send_cmd.sock == &tmp) { - udp_socket_close(&tmp); - } - mutex_unlock(&send_cmd.block); - - return send_cmd.res; -} - -static void _timeout_callback(void *arg) -{ - msg_t msg = { .type = _MSG_TYPE_TIMEOUT }; - mbox_t *mbox = arg; - - /* should be safe, because otherwise if mbox were filled this callback is - * senseless */ - mbox_try_put(mbox, &msg); -} - -static void _input_callback(struct udp_socket *c, void *ptr, - const uip_ipaddr_t *src_addr, uint16_t src_port, - const uip_ipaddr_t *dst_addr, uint16_t dst_port, - const uint8_t *data, uint16_t datalen) -{ - msg_t msg = { .type = _MSG_TYPE_RCV }; - sock_udp_t *sock = ptr; - - (void)dst_addr; - (void)dst_port; - mutex_lock(&sock->mutex); - sock->recv_info.src_port = src_port; - sock->recv_info.src = (const ipv6_addr_t *)src_addr; - sock->recv_info.data = data; - sock->recv_info.datalen = datalen - sizeof(ipv6_hdr_t); - mutex_unlock(&sock->mutex); - mbox_put(&sock->mbox, &msg); -} - -static void _output_callback(c_event_t c_event, p_data_t p_data) -{ - - if ((c_event != EVENT_TYPE_SOCK_SEND) || (p_data == NULL)) { - return; - } - - _send_cmd_t *send_cmd = (_send_cmd_t *)p_data; - - if (send_cmd->remote != NULL) { - /* send_cmd->len was previously checked */ - send_cmd->res = udp_socket_sendto(send_cmd->sock, send_cmd->data, - (uint16_t)send_cmd->len, - (uip_ipaddr_t *)&send_cmd->remote->addr, - send_cmd->remote->port); - } - else { - /* send_cmd->len was previously checked */ - send_cmd->res = udp_socket_send(send_cmd->sock, send_cmd->data, - (uint16_t)send_cmd->len); - } - send_cmd->res = (send_cmd->res < 0) ? -EHOSTUNREACH : send_cmd->res; - /* notify notify waiting thread */ - mutex_unlock(&send_cmd->block); -} -/** @} */ diff --git a/pkg/emb6/contrib/target.c b/pkg/emb6/contrib/target.c deleted file mode 100644 index c3c1ed3fba..0000000000 --- a/pkg/emb6/contrib/target.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (C) 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. - */ - -/** - * @{ - * - * @file - * @author Martine Lenders - */ - -#include - -#include "cpu.h" -#include "led.h" -#include "mutex.h" -#include "periph/gpio.h" -#include "periph/hwrng.h" -#ifdef MODULE_RANDOM -#include "random.h" -#endif -#include "xtimer.h" - -#include "target.h" -#include "bsp.h" - -static mutex_t critical_mutex = MUTEX_INIT; - -void hal_enterCritical(void) -{ - mutex_lock(&critical_mutex); -} - -void hal_exitCritical(void) -{ - mutex_unlock(&critical_mutex); -} - -int8_t hal_init(void) -{ - /* Should have happened long before emb6 started, so nothing to do */ - return 1; -} - -uint8_t hal_getrand(void) -{ -#if defined(MODULE_PERIPH_HWRNG) - uint8_t res; - hwrng_read((char *)&res, sizeof(res)); - return res; -#elif defined(MODULE_RANDOM) - return (uint8_t)(random_uint32() % UINT8_MAX); -#else - return 4; /* keeping the meme alive ;-) */ -#endif -} - -void hal_ledOn(uint16_t ui_led) -{ - switch (ui_led) { - case E_BSP_LED_RED: - LED0_ON; - break; - case E_BSP_LED_YELLOW: - LED1_ON; - break; - case E_BSP_LED_GREEN: - LED2_ON; - break; - default: - break; - } -} - -void hal_ledOff(uint16_t ui_led) -{ - switch (ui_led) { - case E_BSP_LED_RED: - LED0_OFF; - break; - case E_BSP_LED_YELLOW: - LED1_OFF; - break; - case E_BSP_LED_GREEN: - LED2_OFF; - break; - default: - break; - } -} - -uint8_t hal_extIntInit(en_targetExtInt_t e_extInt, pfn_intCallb_t pfn_intCallback) -{ - /* RIOT does this in netdev initialization so nothing to do here. */ - return 0; -} - -void hal_delay_us(uint32_t i_delay) -{ - xtimer_usleep(i_delay); -} - -uint8_t hal_gpioPinInit(uint8_t c_pin, uint8_t c_dir, uint8_t c_initState) -{ - /* Only used in board init code => not needed */ - (void)c_pin; - (void)c_dir; - (void)c_initState; - return 0; -} - -void *hal_ctrlPinInit(en_targetExtPin_t e_pinType) -{ - (void)e_pinType; - return NULL; -} - -void hal_pinSet(void *p_pin) -{ - /* Only used in board/driver-related code code => not needed */ -} - -void hal_pinClr(void *p_pin) -{ - /* Only used in board/driver-related code code => not needed */ -} - -uint8_t hal_pinGet(void *p_pin) -{ - /* Only used in board/driver-related code code => not needed */ - return 0; -} - -void *hal_spiInit(void) -{ - /* Only used in board/driver-related code code => not needed */ - return 0; -} - -/*----------------------------------------------------------------------------*/ -/** \brief This function selects slave with which we will work - * \param p_spi Pointer to spi description entity - * \param action true or false - * - * \return 0 if failed, 1 id ok - */ -/*---------------------------------------------------------------------------*/ -uint8_t hal_spiSlaveSel(void *p_spi, bool action) -{ - /* Only used in board/driver-related code code => not needed */ - return 0; -} - -uint8_t hal_spiTransceive( uint8_t *txData, uint8_t *p_reg) -{ - /* Only used in board/driver-related code code => not needed */ - return 0; -} - -uint8_t hal_spiRead(uint8_t *p_reg, uint16_t i_length) -{ - /* Only used in board/driver-related code code => not needed */ - return 0; -} - - -/*----------------------------------------------------------------------------*/ -/** \brief This function writes a new value via given SPI interface - * registers. - * - * - * \param value Pointer to a value. - * \param i_length Length of a data to be received - */ -/*----------------------------------------------------------------------------*/ -void hal_spiWrite(uint8_t *value, uint16_t i_length) -{ - /* Only used in board/driver-related code code => not needed */ -} - -void hal_watchdogReset(void) -{ - /* WDT and tick-less scheduling don't make much sense */ -} - -void hal_watchdogStart(void) -{ - /* WDT and tick-less scheduling don't make much sense */ -} - -void hal_watchdogStop(void) -{ - /* WDT and tick-less scheduling don't make much sense */ -} - -clock_time_t hal_getTick(void) -{ - return (clock_time_t)xtimer_now_usec(); -} - -clock_time_t hal_getSec(void) -{ - return (clock_time_t)xtimer_now_usec() / US_PER_SEC; -} - - -clock_time_t hal_getTRes(void) -{ - return US_PER_SEC; -} - -/** @} */ diff --git a/pkg/emb6/doc.txt b/pkg/emb6/doc.txt deleted file mode 100644 index 644009a801..0000000000 --- a/pkg/emb6/doc.txt +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @defgroup pkg_emb6 emb6 network stack - * @ingroup pkg - * @ingroup net - * @brief emb6 network stack - * @see https://github.com/hso-esk/emb6/blob/14e4a3cfff01644e078870e14e16a1fe60dcc895/doc/pdf/emb6.pdf - * - * @deprecated Based on very old version of `emb6` and the package is - * basically unmaintained; will be removed after the 2020.07 - * release. - * - * emb6 is a fork of Contiki's uIP network stack without its usage of - * proto-threads. It uses periodic event polling instead. - */ diff --git a/pkg/emb6/include/board_conf.h b/pkg/emb6/include/board_conf.h deleted file mode 100644 index 5480583e5b..0000000000 --- a/pkg/emb6/include/board_conf.h +++ /dev/null @@ -1,45 +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. - */ - -/** - * @addtogroup pkg_emb6 - * @brief - * @{ - * - * @file - * @brief "Board" configuration for emb6 - * - * @author Martine Lenders - */ - -#ifndef BOARD_CONF_H -#define BOARD_CONF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "emb6.h" - -/** - * @brief emb6 board configuration function - * - * @param[in] ps_nStack pointer to global netstack struct - * - * @return success 1 - * @return failure 0 - */ -uint8_t board_conf(s_ns_t *ps_nStack); - -#ifdef __cplusplus -} -#endif - -#endif /* BOARD_CONF_H */ -/** @} */ -/** @} */ diff --git a/pkg/emb6/include/emb6/netdev.h b/pkg/emb6/include/emb6/netdev.h deleted file mode 100644 index 8bc87c6ec8..0000000000 --- a/pkg/emb6/include/emb6/netdev.h +++ /dev/null @@ -1,56 +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. - */ - -/** - * @defgroup pkg_emb6_netdev netdev wrapper for emb6 - * @ingroup pkg_emb6 - * @brief - * @{ - * - * @file - * @brief - * - * @author Martine Lenders - */ -#ifndef EMB6_NETDEV_H -#define EMB6_NETDEV_H - -#include "net/netdev.h" - -#include "emb6.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief The emb6 network interface. - * - * @note emb6 only supports one network interface. - * - * This variable is used by @ref board_conf() to set the interface for the - * stack. - */ -extern const s_nsIf_t emb6_netdev_driver; - -/** - * @brief Setup a network device as the emb6 interface. - * - * @param[in] dev The network device for the interface - * - * @return 0 on success. - * @return <= 0 on error. - */ -int emb6_netdev_setup(netdev_t *dev); - -#ifdef __cplusplus -} -#endif - -#endif /* EMB6_NETDEV_H */ -/** @} */ diff --git a/pkg/emb6/include/sock_types.h b/pkg/emb6/include/sock_types.h deleted file mode 100644 index 9240e78329..0000000000 --- a/pkg/emb6/include/sock_types.h +++ /dev/null @@ -1,69 +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. - */ - -/** - * @defgroup pkg_emb6_sock emb6-specific implementation of the sock API - * @ingroup pkg_emb6 - * @brief - * @{ - * - * @file - * @brief - * - * @author Martine Lenders - */ -#ifndef SOCK_TYPES_H -#define SOCK_TYPES_H - -#include - -#include "mbox.h" -#include "mutex.h" -#include "net/ipv6/addr.h" - -#include "uip.h" -#include "udp-socket.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Size for struct sock_udp::mbox_queue - */ -#ifndef SOCK_MBOX_SIZE -#define SOCK_MBOX_SIZE (2) -#endif - -#ifndef SOCK_HAS_IPV6 -#error "emb6 only runs with IPv6 support" -#endif - -/** - * @brief @ref net_sock_udp definition for emb6 - */ -struct sock_udp { - struct udp_socket sock; /**< emb6 internal socket */ - mutex_t mutex; /**< mutex for the connection */ - mbox_t mbox; /**< mbox for receiving */ - msg_t mbox_queue[SOCK_MBOX_SIZE]; /**< queue for mbox */ - atomic_int receivers; /**< current number of recv calls */ - struct { - const ipv6_addr_t *src; /**< source address */ - const void *data; /**< data of received packet */ - size_t datalen; /**< length of received packet data */ - uint16_t src_port; /**< source port */ - } recv_info; /**< info on received packet */ -}; - -#ifdef __cplusplus -} -#endif - -#endif /* SOCK_TYPES_H */ -/** @} */ diff --git a/pkg/emb6/patches/0001-Add-RIOT-Makefiles.patch b/pkg/emb6/patches/0001-Add-RIOT-Makefiles.patch deleted file mode 100644 index 6854487410..0000000000 --- a/pkg/emb6/patches/0001-Add-RIOT-Makefiles.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 5854e2307826af0800e64c916160cb7fe94aadbb Mon Sep 17 00:00:00 2001 -From: Martine Lenders -Date: Mon, 11 Jan 2016 15:09:34 +0100 -Subject: [PATCH 1/3] Add RIOT Makefiles - ---- - Makefile | 1 + - emb6/Makefile | 3 +++ - emb6/src/mac/Makefile | 3 +++ - emb6/src/mac/llsec/Makefile | 3 +++ - emb6/src/net/ipv6/Makefile | 3 +++ - emb6/src/net/ipv6/multicast/Makefile | 3 +++ - emb6/src/net/rpl/Makefile | 3 +++ - emb6/src/net/sicslowpan/Makefile | 3 +++ - emb6/src/tport/Makefile | 3 +++ - target/bsp/Makefile | 3 +++ - utils/src/Makefile | 3 +++ - 11 files changed, 31 insertions(+) - create mode 100644 Makefile - create mode 100644 emb6/Makefile - create mode 100644 emb6/src/mac/Makefile - create mode 100644 emb6/src/mac/llsec/Makefile - create mode 100644 emb6/src/net/ipv6/Makefile - create mode 100644 emb6/src/net/ipv6/multicast/Makefile - create mode 100644 emb6/src/net/rpl/Makefile - create mode 100644 emb6/src/net/sicslowpan/Makefile - create mode 100644 emb6/src/tport/Makefile - create mode 100644 target/bsp/Makefile - create mode 100644 utils/src/Makefile - -diff --git a/Makefile b/Makefile -new file mode 100644 -index 00000000..48422e90 ---- /dev/null -+++ b/Makefile -@@ -0,0 +1 @@ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/Makefile b/emb6/Makefile -new file mode 100644 -index 00000000..c2ec39f3 ---- /dev/null -+++ b/emb6/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_common -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/src/mac/Makefile b/emb6/src/mac/Makefile -new file mode 100644 -index 00000000..d0472d85 ---- /dev/null -+++ b/emb6/src/mac/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_mac -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/src/mac/llsec/Makefile b/emb6/src/mac/llsec/Makefile -new file mode 100644 -index 00000000..e13ee7f1 ---- /dev/null -+++ b/emb6/src/mac/llsec/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_llsec -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/src/net/ipv6/Makefile b/emb6/src/net/ipv6/Makefile -new file mode 100644 -index 00000000..844e39cd ---- /dev/null -+++ b/emb6/src/net/ipv6/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_ipv6 -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/src/net/ipv6/multicast/Makefile b/emb6/src/net/ipv6/multicast/Makefile -new file mode 100644 -index 00000000..f1c3f1e0 ---- /dev/null -+++ b/emb6/src/net/ipv6/multicast/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_ipv6_multicast -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/src/net/rpl/Makefile b/emb6/src/net/rpl/Makefile -new file mode 100644 -index 00000000..2fd941c7 ---- /dev/null -+++ b/emb6/src/net/rpl/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_rpl -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/src/net/sicslowpan/Makefile b/emb6/src/net/sicslowpan/Makefile -new file mode 100644 -index 00000000..9e14df33 ---- /dev/null -+++ b/emb6/src/net/sicslowpan/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_sicslowpan -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/emb6/src/tport/Makefile b/emb6/src/tport/Makefile -new file mode 100644 -index 00000000..1b0ca7c2 ---- /dev/null -+++ b/emb6/src/tport/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_sock -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/target/bsp/Makefile b/target/bsp/Makefile -new file mode 100644 -index 00000000..ce548bd1 ---- /dev/null -+++ b/target/bsp/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_bsp -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/utils/src/Makefile b/utils/src/Makefile -new file mode 100644 -index 00000000..c9aa8979 ---- /dev/null -+++ b/utils/src/Makefile -@@ -0,0 +1,3 @@ -+MODULE := emb6_utils -+ -+include $(RIOTBASE)/Makefile.base --- -2.16.4 - diff --git a/pkg/emb6/patches/0002-Rename-colliding-files-and-functions.patch b/pkg/emb6/patches/0002-Rename-colliding-files-and-functions.patch deleted file mode 100644 index 24eaef3e6a..0000000000 --- a/pkg/emb6/patches/0002-Rename-colliding-files-and-functions.patch +++ /dev/null @@ -1,1167 +0,0 @@ -From 4e6d1640adde2828f10320d39f8996c6e89f82ac Mon Sep 17 00:00:00 2001 -From: Martine Lenders -Date: Thu, 4 Feb 2016 22:15:23 +0100 -Subject: [PATCH 2/3] Rename colliding files and functions - -Co-authored-by: Koen Zandberg ---- - emb6/emb6.c | 2 +- - emb6/inc/apl/rest-engine/rest-engine.h | 2 +- - emb6/inc/net/ipv6/uip-ds6-route.h | 2 +- - emb6/inc/net/rpl/rpl-private.h | 2 +- - emb6/inc/net/rpl/rpl.h | 2 +- - emb6/src/apl/er-coap/er-coap-observe.c | 4 ++-- - emb6/src/apl/er-coap/er-coap-transactions.c | 8 ++++---- - emb6/src/apl/er-coap/er-coap.c | 4 ++-- - emb6/src/apl/rest-engine/rest-engine.c | 4 ++-- - emb6/src/mac/framer-802154.c | 4 ++-- - emb6/src/mac/sicslowmac.c | 4 ++-- - emb6/src/net/ipv6/multicast/roll-tm.c | 4 ++-- - emb6/src/net/ipv6/multicast/smrf.c | 4 ++-- - emb6/src/net/ipv6/multicast/uip-mcast6-route.c | 6 +++--- - emb6/src/net/ipv6/nbr-table.c | 6 +++--- - emb6/src/net/ipv6/uip-ds6-nbr.c | 2 +- - emb6/src/net/ipv6/uip-ds6-route.c | 16 ++++++++-------- - emb6/src/net/ipv6/uip-ds6.c | 16 ++++++++-------- - emb6/src/net/ipv6/uip-icmp6.c | 6 +++--- - emb6/src/net/ipv6/uip-nameserver.c | 8 ++++---- - emb6/src/net/ipv6/uip-nd6.c | 2 +- - emb6/src/net/rpl/rpl-dag.c | 2 +- - emb6/src/net/rpl/rpl-timers.c | 8 ++++---- - emb6/src/net/sicslowpan/sicslowpan.c | 2 +- - emb6/src/tport/tcp-socket.c | 6 +++--- - emb6/src/tport/udp-socket.c | 2 +- - target/bsp/bsp.c | 6 +++--- - target/if/at86rf212b/at86rf212b.c | 2 +- - utils/inc/{clist.h => emb6_clist.h} | 10 +++++----- - utils/inc/{random.h => emb6_random.h} | 6 +++--- - utils/inc/{ringbuffer.h => emb6_ringbuffer.h} | 0 - utils/inc/timer.h | 4 ++-- - utils/src/ctimer.c | 16 ++++++++-------- - utils/src/etimer.c | 12 ++++++------ - utils/src/evproc.c | 2 +- - utils/src/list.c | 10 +++++----- - utils/src/mmem.c | 6 +++--- - utils/src/queuebuf.c | 6 +++--- - utils/src/random.c | 6 +++--- - utils/src/ringbuffer.c | 2 +- - utils/src/timer.c | 6 +++--- - 41 files changed, 111 insertions(+), 111 deletions(-) - rename utils/inc/{clist.h => emb6_clist.h} (94%) - rename utils/inc/{random.h => emb6_random.h} (93%) - rename utils/inc/{ringbuffer.h => emb6_ringbuffer.h} (100%) - -diff --git a/emb6/emb6.c b/emb6/emb6.c -index 29120492..682b7c21 100644 ---- a/emb6/emb6.c -+++ b/emb6/emb6.c -@@ -64,7 +64,7 @@ - #include "queuebuf.h" - #include "linkaddr.h" - #include "ctimer.h" --#include "random.h" -+#include "emb6_random.h" - - #if NETSTACK_CONF_WITH_IPV6 - #include "uip-ds6.h" -diff --git a/emb6/inc/apl/rest-engine/rest-engine.h b/emb6/inc/apl/rest-engine/rest-engine.h -index 2c16c2b9..fc0dca5d 100644 ---- a/emb6/inc/apl/rest-engine/rest-engine.h -+++ b/emb6/inc/apl/rest-engine/rest-engine.h -@@ -41,7 +41,7 @@ - #define REST_ENGINE_H_ - - --#include "clist.h" -+#include "emb6_clist.h" - #include "etimer.h" - - -diff --git a/emb6/inc/net/ipv6/uip-ds6-route.h b/emb6/inc/net/ipv6/uip-ds6-route.h -index 000b3277..31ed0e9d 100644 ---- a/emb6/inc/net/ipv6/uip-ds6-route.h -+++ b/emb6/inc/net/ipv6/uip-ds6-route.h -@@ -42,7 +42,7 @@ - #define UIP_DS6_ROUTE_H - - #include "stimer.h" --#include "clist.h" -+#include "emb6_clist.h" - - void uip_ds6_route_init(void); - -diff --git a/emb6/inc/net/rpl/rpl-private.h b/emb6/inc/net/rpl/rpl-private.h -index 9da57441..5ded041c 100644 ---- a/emb6/inc/net/rpl/rpl-private.h -+++ b/emb6/inc/net/rpl/rpl-private.h -@@ -39,7 +39,7 @@ - - #include "rpl.h" - --#include "clist.h" -+#include "emb6_clist.h" - #include "uip.h" - #include "bsp.h" - #include "ctimer.h" -diff --git a/emb6/inc/net/rpl/rpl.h b/emb6/inc/net/rpl/rpl.h -index 574ca5ea..72699486 100644 ---- a/emb6/inc/net/rpl/rpl.h -+++ b/emb6/inc/net/rpl/rpl.h -@@ -41,7 +41,7 @@ - #include "emb6_conf.h" - #include "emb6.h" - --#include "clist.h" -+#include "emb6_clist.h" - #include "uip.h" - #include "uip-ds6.h" - #include "ctimer.h" -diff --git a/emb6/src/apl/er-coap/er-coap-observe.c b/emb6/src/apl/er-coap/er-coap-observe.c -index 57754ac8..84659a9e 100644 ---- a/emb6/src/apl/er-coap/er-coap-observe.c -+++ b/emb6/src/apl/er-coap/er-coap-observe.c -@@ -80,7 +80,7 @@ coap_add_observer(uip_ipaddr_t *addr, uint16_t port, const uint8_t *token, - PRINTF("Adding observer (%u/%u) for /%s [0x%02X%02X]\n", - list_length(observers_list) + 1, COAP_MAX_OBSERVERS, - o->url, o->token[0], o->token[1]); -- list_add(observers_list, o); -+ emb6_list_add(observers_list, o); - } - - return o; -@@ -95,7 +95,7 @@ coap_remove_observer(coap_observer_t *o) - o->token[1]); - - memb_free(&observers_memb, o); -- list_remove(observers_list, o); -+ emb6_list_remove(observers_list, o); - } - /*---------------------------------------------------------------------------*/ - int -diff --git a/emb6/src/apl/er-coap/er-coap-transactions.c b/emb6/src/apl/er-coap/er-coap-transactions.c -index e40f4c96..eab66380 100644 ---- a/emb6/src/apl/er-coap/er-coap-transactions.c -+++ b/emb6/src/apl/er-coap/er-coap-transactions.c -@@ -43,7 +43,7 @@ - #include "timer.h" - #include "evproc.h" - #include "memb.h" --#include "random.h" -+#include "emb6_random.h" - - #include "tcpip.h" - -@@ -84,7 +84,7 @@ coap_new_transaction(uint16_t mid, uip_ipaddr_t *addr, uint16_t port) - t->addr = *addr; - t->port = port; - -- list_add(transactions_list, t); /* list itself makes sure same element is not added twice */ -+ emb6_list_add(transactions_list, t); /* list itself makes sure same element is not added twice */ - } - - return t; -@@ -105,7 +105,7 @@ coap_send_transaction(coap_transaction_t *t) - - if(t->retrans_counter == 0) { - t->retrans_timer.timer.interval = -- COAP_RESPONSE_TIMEOUT_TICKS + (random_rand() -+ COAP_RESPONSE_TIMEOUT_TICKS + (emb6_random_rand() - % - (clock_time_t) - COAP_RESPONSE_TIMEOUT_BACKOFF_MASK); -@@ -148,7 +148,7 @@ coap_clear_transaction(coap_transaction_t *t) - PRINTF("Freeing transaction %u: %p\n\r", t->mid, t); - - etimer_stop(&t->retrans_timer); -- list_remove(transactions_list, t); -+ emb6_list_remove(transactions_list, t); - memb_free(&transactions_memb, t); - } - } -diff --git a/emb6/src/apl/er-coap/er-coap.c b/emb6/src/apl/er-coap/er-coap.c -index 40f68748..c173c5e9 100644 ---- a/emb6/src/apl/er-coap/er-coap.c -+++ b/emb6/src/apl/er-coap/er-coap.c -@@ -39,7 +39,7 @@ - #include - #include - --#include "random.h" -+#include "emb6_random.h" - - #include "er-coap.h" - #include "er-coap-transactions.h" -@@ -290,7 +290,7 @@ coap_init_connection(uint16_t port, udp_socket_input_callback_t pf_coap_receive) - uip_ntohs(pst_udp_socket->udp_conn->lport)); - - /* initialize transaction ID */ -- current_mid = random_rand(); -+ current_mid = emb6_random_rand(); - } - /*---------------------------------------------------------------------------*/ - uint16_t -diff --git a/emb6/src/apl/rest-engine/rest-engine.c b/emb6/src/apl/rest-engine/rest-engine.c -index fd8d1ba3..818f3266 100644 ---- a/emb6/src/apl/rest-engine/rest-engine.c -+++ b/emb6/src/apl/rest-engine/rest-engine.c -@@ -104,7 +104,7 @@ rest_activate_resource(resource_t *resource, char *path) - { - resource->url = path; - struct periodic_resource_s * periodic = resource->un_handler.periodic; -- list_add(restful_services, resource); -+ emb6_list_add(restful_services, resource); - - PRINTF("Activating: %s\n\r", resource->url); - -@@ -112,7 +112,7 @@ rest_activate_resource(resource_t *resource, char *path) - if((resource->flags & IS_PERIODIC) && periodic->periodic_handler - && periodic->period) { - PRINTF("Periodic resource: %p (%s)\n", periodic,periodic->resource->url); -- list_add(restful_periodic_services, periodic); -+ emb6_list_add(restful_periodic_services, periodic); - } - - for(periodic_resource = -diff --git a/emb6/src/mac/framer-802154.c b/emb6/src/mac/framer-802154.c -index f99486dc..e1ad9e24 100644 ---- a/emb6/src/mac/framer-802154.c -+++ b/emb6/src/mac/framer-802154.c -@@ -45,7 +45,7 @@ - #include "frame802154.h" - #include "llsec802154.h" - #include "packetbuf.h" --#include "random.h" -+#include "emb6_random.h" - - - -@@ -103,7 +103,7 @@ static int8_t create_frame(int type, int do_create) - - if(!initialized) { - initialized = 1; -- mac_dsn = random_rand() & 0xff; -+ mac_dsn = emb6_random_rand() & 0xff; - } - - /* Build the FCF. */ -diff --git a/emb6/src/mac/sicslowmac.c b/emb6/src/mac/sicslowmac.c -index 7219fa8c..58949f0e 100644 ---- a/emb6/src/mac/sicslowmac.c -+++ b/emb6/src/mac/sicslowmac.c -@@ -51,7 +51,7 @@ - #include "frame802154.h" - #include "packetbuf.h" - #include "queuebuf.h" --#include "random.h" -+#include "emb6_random.h" - - #define DEBUG DEBUG_NONE - -@@ -256,7 +256,7 @@ static int8_t off(int keep_radio_on) - /*---------------------------------------------------------------------------*/ - static void init(s_ns_t* p_netStack) - { -- mac_dsn = random_rand() % 256; -+ mac_dsn = emb6_random_rand() % 256; - - if ((p_netStack != NULL) && (p_netStack->inif != NULL)) { - p_ns = p_netStack; -diff --git a/emb6/src/net/ipv6/multicast/roll-tm.c b/emb6/src/net/ipv6/multicast/roll-tm.c -index 8fb1717a..c1504726 100644 ---- a/emb6/src/net/ipv6/multicast/roll-tm.c -+++ b/emb6/src/net/ipv6/multicast/roll-tm.c -@@ -51,7 +51,7 @@ - #include "roll-tm.h" - #include "bsp.h" - #include "ctimer.h" --#include "random.h" -+#include "emb6_random.h" - //#include "dev/watchdog.h" - //#include - -@@ -494,7 +494,7 @@ random_interval(clock_time_t i_min, uint8_t d) - VERBOSE_PRINTF("ROLL TM: Random [%lu, %lu)\n", (unsigned long)min, - (unsigned long)(TRICKLE_TIME(i_min, d))); - -- return min + (random_rand() % (TRICKLE_TIME(i_min, d) - 1 - min)); -+ return min + (emb6_random_rand() % (TRICKLE_TIME(i_min, d) - 1 - min)); - } - /*---------------------------------------------------------------------------*/ - /* Called at the end of the current interval for timer ptr */ -diff --git a/emb6/src/net/ipv6/multicast/smrf.c b/emb6/src/net/ipv6/multicast/smrf.c -index 474c41d4..abe22355 100644 ---- a/emb6/src/net/ipv6/multicast/smrf.c -+++ b/emb6/src/net/ipv6/multicast/smrf.c -@@ -52,7 +52,7 @@ - #include "smrf.h" - #include "rpl.h" - #include "packetbuf.h" --#include "random.h" -+#include "emb6_random.h" - //#include "net/netstack.h" - - #define DEBUG DEBUG_NONE -@@ -170,7 +170,7 @@ in() - fwd_spread = SMRF_MAX_SPREAD; - } - if(fwd_spread) { -- fwd_delay = fwd_delay * (1 + ((random_rand() >> 11) % fwd_spread)); -+ fwd_delay = fwd_delay * (1 + ((emb6_random_rand() >> 11) % fwd_spread)); - } - - memcpy(&mcast_buf, uip_buf, uip_len); -diff --git a/emb6/src/net/ipv6/multicast/uip-mcast6-route.c b/emb6/src/net/ipv6/multicast/uip-mcast6-route.c -index aa0caff8..995ff0c9 100644 ---- a/emb6/src/net/ipv6/multicast/uip-mcast6-route.c -+++ b/emb6/src/net/ipv6/multicast/uip-mcast6-route.c -@@ -43,7 +43,7 @@ - //#include "contiki.h" - #include "emb6_conf.h" - #include "emb6.h" --#include "clist.h" -+#include "emb6_clist.h" - #include "memb.h" - #include "uip.h" - #include "uip-mcast6-route.h" -@@ -88,7 +88,7 @@ uip_mcast6_route_add(uip_ipaddr_t *group) - if(locmcastrt == NULL) { - return NULL; - } -- list_add(mcast_route_list, locmcastrt); -+ emb6_list_add(mcast_route_list, locmcastrt); - } - - /* Reaching here means we either found the prefix or allocated a new one */ -@@ -106,7 +106,7 @@ uip_mcast6_route_rm(uip_mcast6_route_t *route) - locmcastrt != NULL; - locmcastrt = list_item_next(locmcastrt)) { - if(locmcastrt == route) { -- list_remove(mcast_route_list, route); -+ emb6_list_remove(mcast_route_list, route); - memb_free(&mcast_route_memb, route); - return; - } -diff --git a/emb6/src/net/ipv6/nbr-table.c b/emb6/src/net/ipv6/nbr-table.c -index 7dedece5..d72c1c93 100644 ---- a/emb6/src/net/ipv6/nbr-table.c -+++ b/emb6/src/net/ipv6/nbr-table.c -@@ -41,7 +41,7 @@ - #include - #include - #include "memb.h" --#include "clist.h" -+#include "emb6_clist.h" - #include "nbr-table.h" - - /* List of link-layer addresses of the neighbors, used as key in the tables */ -@@ -221,7 +221,7 @@ nbr_table_allocate(void) - /* Empty used map */ - used_map[index_from_key(least_used_key)] = 0; - /* Remove neighbor from list */ -- list_remove(nbr_table_keys, least_used_key); -+ emb6_list_remove(nbr_table_keys, least_used_key); - /* Return associated key */ - return least_used_key; - } -@@ -295,7 +295,7 @@ nbr_table_add_lladdr(nbr_table_t *table, const linkaddr_t *lladdr) - } - - /* Add neighbor to list */ -- list_add(nbr_table_keys, key); -+ emb6_list_add(nbr_table_keys, key); - - /* Get index from newly allocated neighbor */ - index = index_from_key(key); -diff --git a/emb6/src/net/ipv6/uip-ds6-nbr.c b/emb6/src/net/ipv6/uip-ds6-nbr.c -index 360fdbc2..53ad8dad 100644 ---- a/emb6/src/net/ipv6/uip-ds6-nbr.c -+++ b/emb6/src/net/ipv6/uip-ds6-nbr.c -@@ -46,7 +46,7 @@ - #include - #include - #include --#include "clist.h" -+#include "emb6_clist.h" - #include "linkaddr.h" - #include "packetbuf.h" - #include "uip-ds6-nbr.h" -diff --git a/emb6/src/net/ipv6/uip-ds6-route.c b/emb6/src/net/ipv6/uip-ds6-route.c -index c732f78c..e54a18fe 100644 ---- a/emb6/src/net/ipv6/uip-ds6-route.c -+++ b/emb6/src/net/ipv6/uip-ds6-route.c -@@ -42,7 +42,7 @@ - #include "uip-ds6.h" - #include "uip.h" - --#include "clist.h" -+#include "emb6_clist.h" - #include "memb.h" - #include "nbr-table.h" - -@@ -133,14 +133,14 @@ uip_ds6_notification_add(struct uip_ds6_notification *n, - { - if(n != NULL && c != NULL) { - n->callback = c; -- list_add(notificationlist, n); -+ emb6_list_add(notificationlist, n); - } - } - /*---------------------------------------------------------------------------*/ - void - uip_ds6_notification_rm(struct uip_ds6_notification *n) - { -- list_remove(notificationlist, n); -+ emb6_list_remove(notificationlist, n); - } - #endif - /*---------------------------------------------------------------------------*/ -@@ -249,7 +249,7 @@ uip_ds6_route_lookup(uip_ipaddr_t *addr) - list. The list is ordered by how recently we looked them up: - the least recently used route will be at the end of the - list - for fast lookups (assuming multiple packets to the same node). */ -- list_remove(routelist, found_route); -+ emb6_list_remove(routelist, found_route); - list_push(routelist, found_route); - } - -@@ -375,7 +375,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length, - - nbrr->route = r; - /* Add the route to this neighbor */ -- list_add(routes->route_list, nbrr); -+ emb6_list_add(routes->route_list, nbrr); - r->neighbor_routes = routes; - num_routes++; - -@@ -421,7 +421,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route) - PRINTF("\n\r"); - - /* Remove the route from the route list */ -- list_remove(routelist, route); -+ emb6_list_remove(routelist, route); - - /* Find the corresponding neighbor_route and remove it. */ - for(neighbor_route = list_head(route->neighbor_routes->route_list); -@@ -433,7 +433,7 @@ uip_ds6_route_rm(uip_ds6_route_t *route) - uip_debug_ipaddr_print(&route->ipaddr); - PRINTF("\n"); - } -- list_remove(route->neighbor_routes->route_list, neighbor_route); -+ emb6_list_remove(route->neighbor_routes->route_list, neighbor_route); - if(list_head(route->neighbor_routes->route_list) == NULL) { - /* If this was the only route using this neighbor, remove the - neibhor from the table */ -@@ -581,7 +581,7 @@ uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt) - d = list_item_next(d)) { - if(d == defrt) { - PRINTF("Removing default route\n\r"); -- list_remove(defaultrouterlist, defrt); -+ emb6_list_remove(defaultrouterlist, defrt); - memb_free(&defaultroutermemb, defrt); - ANNOTATE("#L %u 0\n\r", defrt->ipaddr.u8[sizeof(uip_ipaddr_t) - 1]); - #if UIP_DS6_NOTIFICATIONS -diff --git a/emb6/src/net/ipv6/uip-ds6.c b/emb6/src/net/ipv6/uip-ds6.c -index 0e2f16ae..de23f3e2 100644 ---- a/emb6/src/net/ipv6/uip-ds6.c -+++ b/emb6/src/net/ipv6/uip-ds6.c -@@ -49,7 +49,7 @@ - #include - #include - #include --#include "random.h" -+#include "emb6_random.h" - #include "uip-nd6.h" - #include "uip-ds6.h" - #include "uip-packetqueue.h" -@@ -136,7 +136,7 @@ uip_ds6_init(void) - #endif /* UIP_ND6_SEND_RA */ - #else /* UIP_CONF_ROUTER */ - etimer_set(&uip_ds6_timer_rs, -- random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY * -+ emb6_random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY * - bsp_get(E_BSP_GET_TRES)), tcpip_gethandler()); - #endif /* UIP_CONF_ROUTER */ - etimer_set(&uip_ds6_timer_periodic, UIP_DS6_PERIOD, (pfn_callback_t) tcpip_gethandler()); -@@ -343,8 +343,8 @@ uip_ds6_addr_add(uip_ipaddr_t *ipaddr, unsigned long vlifetime, uint8_t type) - } - #if UIP_ND6_DEF_MAXDADNS > 0 - locaddr->state = ADDR_TENTATIVE; -- timer_set(&locaddr->dadtimer, -- random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY * -+ timer_emb6_set(&locaddr->dadtimer, -+ emb6_random_rand() % (UIP_ND6_MAX_RTR_SOLICITATION_DELAY * - bsp_get(E_BSP_GET_TRES))); - locaddr->dadnscount = 0; - #else /* UIP_ND6_DEF_MAXDADNS > 0 */ -@@ -591,7 +591,7 @@ uip_ds6_dad(uip_ds6_addr_t *addr) - if(addr->dadnscount < uip_ds6_if.maxdadns) { - uip_nd6_ns_output(NULL, NULL, &addr->ipaddr); - addr->dadnscount++; -- timer_set(&addr->dadtimer, -+ timer_emb6_set(&addr->dadtimer, - uip_ds6_if.retrans_timer / 1000 * bsp_get(E_BSP_GET_TRES)); - return; - } -@@ -661,7 +661,7 @@ uip_ds6_send_ra_periodic(void) - PRINTF("Sending periodic RA\n\r"); - } - -- rand_time = UIP_ND6_MIN_RA_INTERVAL + random_rand() % -+ rand_time = UIP_ND6_MIN_RA_INTERVAL + emb6_random_rand() % - (uint16_t) (UIP_ND6_MAX_RA_INTERVAL - UIP_ND6_MIN_RA_INTERVAL); - PRINTF("Random time 1 = %u\n\r", rand_time); - -@@ -704,8 +704,8 @@ uip_ds6_compute_reachable_time(void) - { - return (uint32_t) (UIP_ND6_MIN_RANDOM_FACTOR - (uip_ds6_if.base_reachable_time)) + -- ((uint16_t) (random_rand() << 8) + -- (uint16_t) random_rand()) % -+ ((uint16_t) (emb6_random_rand() << 8) + -+ (uint16_t) emb6_random_rand()) % - (uint32_t) (UIP_ND6_MAX_RANDOM_FACTOR(uip_ds6_if.base_reachable_time) - - UIP_ND6_MIN_RANDOM_FACTOR(uip_ds6_if.base_reachable_time)); - } -diff --git a/emb6/src/net/ipv6/uip-icmp6.c b/emb6/src/net/ipv6/uip-icmp6.c -index 00828a3d..2d8b4858 100644 ---- a/emb6/src/net/ipv6/uip-icmp6.c -+++ b/emb6/src/net/ipv6/uip-icmp6.c -@@ -114,7 +114,7 @@ uip_icmp6_input(uint8_t type, uint8_t icode) - void - uip_icmp6_register_input_handler(uip_icmp6_input_handler_t *handler) - { -- list_add(input_handler_list, handler); -+ emb6_list_add(input_handler_list, handler); - } - /*---------------------------------------------------------------------------*/ - static void -@@ -393,14 +393,14 @@ uip_icmp6_echo_reply_callback_add(struct uip_icmp6_echo_reply_notification *n, - { - if(n != NULL && c != NULL) { - n->callback = c; -- list_add(echo_reply_callback_list, n); -+ emb6_list_add(echo_reply_callback_list, n); - } - } - /*---------------------------------------------------------------------------*/ - void - uip_icmp6_echo_reply_callback_rm(struct uip_icmp6_echo_reply_notification *n) - { -- list_remove(echo_reply_callback_list, n); -+ emb6_list_remove(echo_reply_callback_list, n); - } - /*---------------------------------------------------------------------------*/ - UIP_ICMP6_HANDLER(echo_request_handler, ICMP6_ECHO_REQUEST, -diff --git a/emb6/src/net/ipv6/uip-nameserver.c b/emb6/src/net/ipv6/uip-nameserver.c -index 9701b269..4d1d6d36 100644 ---- a/emb6/src/net/ipv6/uip-nameserver.c -+++ b/emb6/src/net/ipv6/uip-nameserver.c -@@ -46,7 +46,7 @@ - #include "uip.h" - #include "uip-nameserver.h" - #include "bsp.h" --#include "clist.h" -+#include "emb6_clist.h" - #include "memb.h" - - #include -@@ -113,7 +113,7 @@ uip_nameserver_update(uip_ipaddr_t *nameserver, uint32_t lifetime) - - if(e == NULL) { - if((e = memb_alloc(&dnsmemb)) != NULL) { -- list_add(dns, e); -+ emb6_list_add(dns, e); - } else { - uip_nameserver_record *p; - for(e = list_head(dns), p = list_head(dns); p != NULL; -@@ -130,7 +130,7 @@ uip_nameserver_update(uip_ipaddr_t *nameserver, uint32_t lifetime) - if(e != NULL) { - if(lifetime == 0) { - memb_free(&dnsmemb, e); -- list_remove(dns, e); -+ emb6_list_remove(dns, e); - } else { - e->added = bsp_getTick(); - e->lifetime = lifetime; -@@ -154,7 +154,7 @@ purge(void) - uint32_t time = bsp_getTick(); - for(e = list_head(dns); e != NULL; e = list_item_next(e)) { - if(DNS_EXPIRATION(e) < time) { -- list_remove(dns, e); -+ emb6_list_remove(dns, e); - memb_free(&dnsmemb, e); - e = list_head(dns); - } -diff --git a/emb6/src/net/ipv6/uip-nd6.c b/emb6/src/net/ipv6/uip-nd6.c -index 8758a8fe..f04b6b34 100644 ---- a/emb6/src/net/ipv6/uip-nd6.c -+++ b/emb6/src/net/ipv6/uip-nd6.c -@@ -78,7 +78,7 @@ - #include "uip-ds6.h" - #include "uip-nameserver.h" - #include "bsp.h" --#include "random.h" -+#include "emb6_random.h" - - /*------------------------------------------------------------------*/ - #define DEBUG DEBUG_NONE -diff --git a/emb6/src/net/rpl/rpl-dag.c b/emb6/src/net/rpl/rpl-dag.c -index cc11eab7..4a85b708 100644 ---- a/emb6/src/net/rpl/rpl-dag.c -+++ b/emb6/src/net/rpl/rpl-dag.c -@@ -50,7 +50,7 @@ - #if UIP_CONF_IPV6_MULTICAST - #include "uip-mcast6.h" - #endif --#include "clist.h" -+#include "emb6_clist.h" - #include "memb.h" - #include "ctimer.h" - -diff --git a/emb6/src/net/rpl/rpl-timers.c b/emb6/src/net/rpl/rpl-timers.c -index 9b235d4c..d349123d 100644 ---- a/emb6/src/net/rpl/rpl-timers.c -+++ b/emb6/src/net/rpl/rpl-timers.c -@@ -47,7 +47,7 @@ - #if UIP_CONF_IPV6_MULTICAST - #include "uip-mcast6.h" - #endif --#include "random.h" -+#include "emb6_random.h" - #include "ctimer.h" - - #define DEBUG DEBUG_NONE -@@ -97,7 +97,7 @@ new_dio_interval(rpl_instance_t *instance) - instance->dio_next_delay = ticks; - - /* random number between I/2 and I */ -- ticks = ticks / 2 + (ticks / 2 * (uint32_t)random_rand()) / RANDOM_RAND_MAX; -+ ticks = ticks / 2 + (ticks / 2 * (uint32_t)emb6_random_rand()) / RANDOM_RAND_MAX; - - /* - * The intervals must be equally long among the nodes for Trickle to -@@ -177,7 +177,7 @@ void - rpl_reset_periodic_timer(void) - { - next_dis = RPL_DIS_INTERVAL / 2 + -- ((uint32_t)RPL_DIS_INTERVAL * (uint32_t)random_rand()) / RANDOM_RAND_MAX - -+ ((uint32_t)RPL_DIS_INTERVAL * (uint32_t)emb6_random_rand()) / RANDOM_RAND_MAX - - RPL_DIS_START_DELAY; - ctimer_set(&periodic_timer, bsp_get(E_BSP_GET_TRES), handle_periodic_timer, NULL); - } -@@ -294,7 +294,7 @@ schedule_dao(rpl_instance_t *instance, clock_time_t latency) - } else { - if(latency != 0) { - expiration_time = latency / 2 + -- (random_rand() % (latency)); -+ (emb6_random_rand() % (latency)); - } else { - expiration_time = 0; - } -diff --git a/emb6/src/net/sicslowpan/sicslowpan.c b/emb6/src/net/sicslowpan/sicslowpan.c -index 8c909cfa..79afefed 100644 ---- a/emb6/src/net/sicslowpan/sicslowpan.c -+++ b/emb6/src/net/sicslowpan/sicslowpan.c -@@ -1738,7 +1738,7 @@ input(void) - - sicslowpan_len = frag_size; - reass_tag = frag_tag; -- timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE * bsp_get(E_BSP_GET_TRES)); -+ timer_emb6_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE * bsp_get(E_BSP_GET_TRES)); - PRINTFI("sicslowpan input: INIT FRAGMENTATION (len %d, tag %d)\n\r", - sicslowpan_len, reass_tag); - linkaddr_copy(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER)); -diff --git a/emb6/src/tport/tcp-socket.c b/emb6/src/tport/tcp-socket.c -index 3974badf..05490f68 100644 ---- a/emb6/src/tport/tcp-socket.c -+++ b/emb6/src/tport/tcp-socket.c -@@ -31,7 +31,7 @@ - - #include "emb6.h" - #include "bsp.h" --#include "clist.h" -+#include "emb6_clist.h" - #include "etimer.h" - - #include "tcp-socket.h" -@@ -276,7 +276,7 @@ tcp_socket_register(struct tcp_socket *s, void *ptr, - s->output_data_maxlen = output_databuf_len; - s->input_callback = input_callback; - s->event_callback = event_callback; -- list_add(socketlist, s); -+ emb6_list_add(socketlist, s); - - s->listen_port = 0; - s->flags = TCP_SOCKET_FLAGS_NONE; -@@ -386,7 +386,7 @@ tcp_socket_unregister(struct tcp_socket *s) - if(s->c != NULL) { - tcp_attach(s->c, NULL); - } -- list_remove(socketlist, s); -+ emb6_list_remove(socketlist, s); - return 1; - } - /*---------------------------------------------------------------------------*/ -diff --git a/emb6/src/tport/udp-socket.c b/emb6/src/tport/udp-socket.c -index be27a5f3..545f6bde 100644 ---- a/emb6/src/tport/udp-socket.c -+++ b/emb6/src/tport/udp-socket.c -@@ -31,7 +31,7 @@ - - #include "emb6.h" - #include "bsp.h" --#include "clist.h" -+#include "emb6_clist.h" - #include "etimer.h" - #include "emb6_conf.h" - #include "tcpip.h" -diff --git a/target/bsp/bsp.c b/target/bsp/bsp.c -index 85c99769..f86199f4 100644 ---- a/target/bsp/bsp.c -+++ b/target/bsp/bsp.c -@@ -45,7 +45,7 @@ - /*============================================================================*/ - /*! \file bsp.c - -- \author Artem Yushev, -+ \author Artem Yushev, - - \brief Board support package implementation. - -@@ -63,7 +63,7 @@ - #include "board_conf.h" - - #include "etimer.h" --#include "random.h" -+#include "emb6_random.h" - #include "evproc.h" - /*============================================================================== - MACROS -@@ -132,7 +132,7 @@ uint8_t bsp_init (s_ns_t * ps_ns) - if (!board_conf(ps_ns)) - return 0; - -- random_init(hal_getrand()); -+ emb6_random_init(hal_getrand()); - - /* Normal exit*/ - return 1; -diff --git a/target/if/at86rf212b/at86rf212b.c b/target/if/at86rf212b/at86rf212b.c -index aba87d59..c059568e 100644 ---- a/target/if/at86rf212b/at86rf212b.c -+++ b/target/if/at86rf212b/at86rf212b.c -@@ -67,7 +67,7 @@ - #include "ctimer.h" - #include "packetbuf.h" - --#include "ringbuffer.h" -+#include "emb6_ringbuffer.h" - - /*============================================================================== - MACROS -diff --git a/utils/inc/clist.h b/utils/inc/emb6_clist.h -similarity index 94% -rename from utils/inc/clist.h -rename to utils/inc/emb6_clist.h -index 0e26be8d..a104f29e 100644 ---- a/utils/inc/clist.h -+++ b/utils/inc/emb6_clist.h -@@ -30,7 +30,7 @@ - * - * Author: Adam Dunkels - * -- * $Id: clist.h,v 1.5 2010/09/13 13:31:00 adamdunkels Exp $ -+ * $Id: emb6_clist.h,v 1.5 2010/09/13 13:31:00 adamdunkels Exp $ - */ - - /** -@@ -52,9 +52,9 @@ - * the name of the list that later is used with all list functions. - * - * Lists can be manipulated by inserting or removing elements from -- * either sides of the list (list_push(), list_add(), list_pop(), -+ * either sides of the list (list_push(), emb6_list_add(), list_pop(), - * list_chop()). A specified element can also be removed from inside a -- * list with list_remove(). The head and tail of a list can be -+ * list with emb6_list_remove(). The head and tail of a list can be - * extracted using list_head() and list_tail(), respectively. - * - * @{ -@@ -145,8 +145,8 @@ void list_push(list_t list, void *item); - - void * list_chop(list_t list); - --void list_add(list_t list, void *item); --void list_remove(list_t list, void *item); -+void emb6_list_add(list_t list, void *item); -+void emb6_list_remove(list_t list, void *item); - - int list_length(list_t list); - -diff --git a/utils/inc/random.h b/utils/inc/emb6_random.h -similarity index 93% -rename from utils/inc/random.h -rename to utils/inc/emb6_random.h -index 3bab9348..29cd792a 100644 ---- a/utils/inc/random.h -+++ b/utils/inc/emb6_random.h -@@ -28,7 +28,7 @@ - * - * This file is part of the Contiki operating system. - * -- * @(#)$Id: random.h,v 1.2 2010/12/13 16:52:02 dak664 Exp $ -+ * @(#)$Id: emb6_random.h,v 1.2 2010/12/13 16:52:02 dak664 Exp $ - */ - /** - * \file -@@ -41,14 +41,14 @@ - * Initialize the pseudo-random generator. - * - */ --void random_init(unsigned short seed); -+void emb6_random_init(unsigned short seed); - - /* - * Calculate a pseudo random number between 0 and 65535. - * - * \return A pseudo-random number between 0 and 65535. - */ --unsigned short random_rand(void); -+unsigned short emb6_random_rand(void); - - /* In gcc int rand() uses RAND_MAX and long random() uses RANDOM_MAX */ - /* Since random_rand casts to unsigned short, we'll use this maxmimum */ -diff --git a/utils/inc/ringbuffer.h b/utils/inc/emb6_ringbuffer.h -similarity index 100% -rename from utils/inc/ringbuffer.h -rename to utils/inc/emb6_ringbuffer.h -diff --git a/utils/inc/timer.h b/utils/inc/timer.h -index ca34bf58..ac1e354f 100644 ---- a/utils/inc/timer.h -+++ b/utils/inc/timer.h -@@ -84,7 +84,7 @@ - * A timer. - * - * This structure is used for declaring a timer. The timer must be set -- * with timer_set() before it can be used. -+ * with timer_emb6_set() before it can be used. - * - * \hideinitializer - */ -@@ -93,7 +93,7 @@ struct timer { - clock_time_t interval; - }; - --void timer_set(struct timer *t, clock_time_t interval); -+void timer_emb6_set(struct timer *t, clock_time_t interval); - void timer_reset(struct timer *t); - void timer_restart(struct timer *t); - int timer_expired(struct timer *t); -diff --git a/utils/src/ctimer.c b/utils/src/ctimer.c -index 9ef215e5..723534b2 100644 ---- a/utils/src/ctimer.c -+++ b/utils/src/ctimer.c -@@ -66,7 +66,7 @@ - #include "evproc.h" - #include "ctimer.h" - #include "timer.h" --#include "clist.h" -+#include "emb6_clist.h" - - /*============================================================================== - LOCAL MACROS -@@ -102,7 +102,7 @@ void ctimer_refresh(c_event_t event, void * data) - pst_cTim != NULL; \ - pst_cTim = pst_cTim->next) { - if(&pst_cTim->etimer == data) { -- list_remove(gp_ctimList, pst_cTim); -+ emb6_list_remove(gp_ctimList, pst_cTim); - if(pst_cTim->f != NULL) { - pst_cTim->f(pst_cTim->ptr); - } -@@ -143,7 +143,7 @@ void ctimer_set(struct ctimer *c, clock_time_t t, - c->etimer.timer.interval = t; - } - -- list_add(gp_ctimList, c); -+ emb6_list_add(gp_ctimList, c); - } - /*============================================================================*/ - /* ctimer_reset() */ -@@ -154,8 +154,8 @@ void ctimer_reset(struct ctimer *c) - etimer_reset(&c->etimer); - } - -- list_remove(gp_ctimList, c); -- list_add(gp_ctimList, c); -+ emb6_list_remove(gp_ctimList, c); -+ emb6_list_add(gp_ctimList, c); - } - /*============================================================================*/ - /* ctimer_restart() */ -@@ -166,8 +166,8 @@ void ctimer_restart(struct ctimer *c) - etimer_restart(&c->etimer); - } - -- list_remove(gp_ctimList, c); -- list_add(gp_ctimList, c); -+ emb6_list_remove(gp_ctimList, c); -+ emb6_list_add(gp_ctimList, c); - } - /*============================================================================*/ - /* ctimer_stop() */ -@@ -180,7 +180,7 @@ void ctimer_stop(struct ctimer *pst_stopTim) - pst_stopTim->etimer.next = NULL; - pst_stopTim->etimer.active = TMR_NOT_ACTIVE; - } -- list_remove(gp_ctimList, pst_stopTim); -+ emb6_list_remove(gp_ctimList, pst_stopTim); - } - /*============================================================================*/ - /* ctimer_expired() */ -diff --git a/utils/src/etimer.c b/utils/src/etimer.c -index e29c5336..59ba8d8e 100644 ---- a/utils/src/etimer.c -+++ b/utils/src/etimer.c -@@ -62,7 +62,7 @@ - ==============================================================================*/ - - #include "etimer.h" --#include "clist.h" -+#include "emb6_clist.h" - - #include "emb6_conf.h" - #include "emb6.h" -@@ -97,8 +97,8 @@ static char gc_init = 0; - /*============================================================================*/ - static void _etimer_addTimer(struct etimer *pst_timer) - { -- list_remove(gp_etimList, pst_timer); -- list_add(gp_etimList, pst_timer); -+ emb6_list_remove(gp_etimList, pst_timer); -+ emb6_list_add(gp_etimList, pst_timer); - pst_timer->active = TMR_ACTIVE; - } - -@@ -151,7 +151,7 @@ void etimer_request_poll(void) - // Generate timer expired event - evproc_putEvent(E_EVPROC_TAIL,EVENT_TYPE_TIMER_EXP,pst_tTim); - // Remove matched timer from the list -- list_remove(gp_etimList, pst_tTim); -+ emb6_list_remove(gp_etimList, pst_tTim); - // Change active flag - pst_tTim->active = TMR_NOT_ACTIVE; - } /* if */ -@@ -164,7 +164,7 @@ void etimer_request_poll(void) - /*============================================================================*/ - void etimer_set(struct etimer *pst_et, clock_time_t l_interval, pfn_callback_t pfn_callback) - { -- timer_set(&pst_et->timer, l_interval); -+ timer_emb6_set(&pst_et->timer, l_interval); - _etimer_addTimer(pst_et); - evproc_regCallback(EVENT_TYPE_TIMER_EXP, pfn_callback); - LOG_INFO("add new timer %p\n\r",pst_et); -@@ -244,7 +244,7 @@ clock_time_t etimer_next_expiration_time(void) - /*============================================================================*/ - void etimer_stop(struct etimer *pst_et) - { -- list_remove(gp_etimList, pst_et); -+ emb6_list_remove(gp_etimList, pst_et); - pst_et->active = TMR_NOT_ACTIVE; - } /* etimer_stop() */ - -diff --git a/utils/src/evproc.c b/utils/src/evproc.c -index 585b0276..9544f0f6 100644 ---- a/utils/src/evproc.c -+++ b/utils/src/evproc.c -@@ -62,7 +62,7 @@ - - #include "bsp.h" - #include "evproc.h" --#include "clist.h" -+#include "emb6_clist.h" - #include "logger.h" - - /*============================================================================== -diff --git a/utils/src/list.c b/utils/src/list.c -index 38d006f9..270da21b 100644 ---- a/utils/src/list.c -+++ b/utils/src/list.c -@@ -46,7 +46,7 @@ - * - */ - --#include "clist.h" -+#include "emb6_clist.h" - - #define NULL 0 - -@@ -141,12 +141,12 @@ list_tail(list_t list) - * - */ - void --list_add(list_t list, void *item) -+emb6_list_add(list_t list, void *item) - { - struct list *l; - - /* Make sure not to add the same element twice */ -- list_remove(list, item); -+ emb6_list_remove(list, item); - - ((struct list *)item)->next = NULL; - -@@ -168,7 +168,7 @@ list_push(list_t list, void *item) - /* struct list *l;*/ - - /* Make sure not to add the same element twice */ -- list_remove(list, item); -+ emb6_list_remove(list, item); - - ((struct list *)item)->next = *list; - *list = item; -@@ -238,7 +238,7 @@ list_pop(list_t list) - */ - /*---------------------------------------------------------------------------*/ - void --list_remove(list_t list, void *item) -+emb6_list_remove(list_t list, void *item) - { - struct list *l, *r; - -diff --git a/utils/src/mmem.c b/utils/src/mmem.c -index 795af1d1..d88471a4 100644 ---- a/utils/src/mmem.c -+++ b/utils/src/mmem.c -@@ -45,7 +45,7 @@ - - - #include "mmem.h" --#include "clist.h" -+#include "emb6_clist.h" - //#include "lib_conf.h" - #include - -@@ -89,7 +89,7 @@ mmem_alloc(struct mmem *m, unsigned int size) - - /* We had enough memory so we add this memory block to the end of - the list of allocated memory blocks. */ -- list_add(mmemlist, m); -+ emb6_list_add(mmemlist, m); - - /* Set up the pointer so that it points to the first available byte - in the memory block. */ -@@ -136,7 +136,7 @@ mmem_free(struct mmem *m) - avail_memory += m->size; - - /* Remove the memory block from the list. */ -- list_remove(mmemlist, m); -+ emb6_list_remove(mmemlist, m); - } - /*---------------------------------------------------------------------------*/ - /** -diff --git a/utils/src/queuebuf.c b/utils/src/queuebuf.c -index 7a9f13f2..809e9c1c 100644 ---- a/utils/src/queuebuf.c -+++ b/utils/src/queuebuf.c -@@ -128,7 +128,7 @@ static struct ctimer renew_timer; - #endif - - #if QUEUEBUF_DEBUG --#include "clist.h" -+#include "emb6_clist.h" - LIST(queuebuf_list); - #endif /* QUEUEBUF_DEBUG */ - -@@ -349,7 +349,7 @@ queuebuf_new_from_packetbuf(void) - buf = memb_alloc(&bufmem); - if(buf != NULL) { - #if QUEUEBUF_DEBUG -- list_add(queuebuf_list, buf); -+ emb6_list_add(queuebuf_list, buf); - buf->file = file; - buf->line = line; - buf->time = clock_time(); -@@ -450,7 +450,7 @@ queuebuf_free(struct queuebuf *buf) - printf("#A q=%d\n", queuebuf_len); - #endif /* QUEUEBUF_STATS */ - #if QUEUEBUF_DEBUG -- list_remove(queuebuf_list, buf); -+ emb6_list_remove(queuebuf_list, buf); - #endif /* QUEUEBUF_DEBUG */ - } else if(memb_inmemb(&refbufmem, buf)) { - memb_free(&refbufmem, buf); -diff --git a/utils/src/random.c b/utils/src/random.c -index 72f5d12a..a884a204 100644 ---- a/utils/src/random.c -+++ b/utils/src/random.c -@@ -36,19 +36,19 @@ - */ - - --#include "random.h" -+#include "emb6_random.h" - - #include - - /*---------------------------------------------------------------------------*/ - void --random_init(unsigned short seed) -+emb6_random_init(unsigned short seed) - { - srand(seed); - } - /*---------------------------------------------------------------------------*/ - unsigned short --random_rand(void) -+emb6_random_rand(void) - { - /* In gcc int rand() uses RAND_MAX and long random() uses RANDOM_MAX=0x7FFFFFFF */ - /* RAND_MAX varies depending on the architecture */ -diff --git a/utils/src/ringbuffer.c b/utils/src/ringbuffer.c -index 5736f8f9..52216c5b 100644 ---- a/utils/src/ringbuffer.c -+++ b/utils/src/ringbuffer.c -@@ -24,7 +24,7 @@ - */ - /*============================================================================*/ - --#include "ringbuffer.h" -+#include "emb6_ringbuffer.h" - /** - * @file - * Implementation of ring ac_buf functions. -diff --git a/utils/src/timer.c b/utils/src/timer.c -index 95c84261..a774c092 100644 ---- a/utils/src/timer.c -+++ b/utils/src/timer.c -@@ -61,7 +61,7 @@ - * \param interval The interval before the timer expires. - * - */ --void timer_set(struct timer *t, clock_time_t interval) -+void timer_emb6_set(struct timer *t, clock_time_t interval) - { - t->interval = interval; - t->start = bsp_getTick(); -@@ -71,7 +71,7 @@ void timer_set(struct timer *t, clock_time_t interval) - * Reset the timer with the same interval. - * - * This function resets the timer with the same interval that was -- * given to the timer_set() function. The start point of the interval -+ * given to the timer_emb6_set() function. The start point of the interval - * is the exact time that the timer last expired. Therefore, this - * function will cause the timer to be stable over time, unlike the - * timer_restart() function. -@@ -89,7 +89,7 @@ void timer_reset(struct timer *t) - * Restart the timer from the current point in time - * - * This function restarts a timer with the same interval that was -- * given to the timer_set() function. The timer will start at the -+ * given to the timer_emb6_set() function. The timer will start at the - * current time. - * - * \note A periodic timer will drift if this function is used to reset --- -2.16.4 - diff --git a/pkg/emb6/patches/0003-Provide-event-type-for-RIOT-s-sock_.-_send.patch b/pkg/emb6/patches/0003-Provide-event-type-for-RIOT-s-sock_.-_send.patch deleted file mode 100644 index 552871c820..0000000000 --- a/pkg/emb6/patches/0003-Provide-event-type-for-RIOT-s-sock_.-_send.patch +++ /dev/null @@ -1,38 +0,0 @@ -From e10a97a564b639294005ed931d4270e5e8d89e7e Mon Sep 17 00:00:00 2001 -From: Martine Lenders -Date: Fri, 26 Feb 2016 12:35:52 +0100 -Subject: [PATCH 3/3] Provide event type for RIOT's sock_.*_send - ---- - utils/inc/evproc.h | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/utils/inc/evproc.h b/utils/inc/evproc.h -index 5316a67e..883a1366 100644 ---- a/utils/inc/evproc.h -+++ b/utils/inc/evproc.h -@@ -79,6 +79,7 @@ - EVENT_TYPE_ICMP6, \ - EVENT_TYPE_TCPIP, \ - EVENT_TYPE_SLIP_POLL, \ -+ EVENT_TYPE_SOCK_SEND, \ - EVENT_TYPE_PCK_LL } - - #define EVENT_TYPE_NONE 0x00 ///< No event -@@ -89,11 +90,12 @@ - #define EVENT_TYPE_ICMP6 0x05 ///< New icmp6 packet event - #define EVENT_TYPE_TCPIP 0x06 ///< New tcpip event - #define EVENT_TYPE_SLIP_POLL 0x07 ///< Process slip handler -+#define EVENT_TYPE_SOCK_SEND 0x08 ///< Send command from sock layer - #define OBLIG_EVENT_PRIOR 0x0a - #define EVENT_TYPE_PCK_LL 0x0a ///< New low level packet received - - --#define EVENT_TYPES_COUNT 8 ///< Counter of events in /ref EVENT_TYPES macro -+#define EVENT_TYPES_COUNT 9 ///< Counter of events in /ref EVENT_TYPES macro - #define MAX_CALLBACK_COUNT 7 ///< Maximal amount of callbacks in /ref st_funcRegList_t list - #define EVPROC_QUEUE_SIZE 20 ///< Maximal amount of events in /ref pst_evList queue - /*============================================================================= --- -2.16.4 - diff --git a/tests/emb6/Makefile b/tests/emb6/Makefile deleted file mode 100644 index c623048548..0000000000 --- a/tests/emb6/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# overwrite board, do not set native as default -BOARD ?= samr21-xpro -include ../Makefile.tests_common - -# MSP-430 doesn't support C11's atomic functionality yet -FEATURES_BLACKLIST += arch_msp430 - -USEPKG += emb6 - -USEMODULE += emb6_router -USEMODULE += emb6_sock_udp -USEMODULE += ipv6_addr -USEMODULE += shell -USEMODULE += shell_commands -USEMODULE += ps -USEMODULE += od - -# define the driver to be used for selected boards -ifneq (,$(filter samr21-xpro,$(BOARD))) - DRIVER := at86rf233 -endif -ifneq (,$(filter iotlab-m3 fox,$(BOARD))) - DRIVER := at86rf231 -endif -ifneq (,$(filter mulle,$(BOARD))) - DRIVER := at86rf212b -endif - -# use the at86rf231 as fallback device -DRIVER ?= at86rf231 - -# include the selected driver -USEMODULE += $(DRIVER) - -CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wno-type-limits -CFLAGS += -Wno-sign-compare -Wno-missing-field-initializers - -include $(RIOTBASE)/Makefile.include diff --git a/tests/emb6/Makefile.ci b/tests/emb6/Makefile.ci deleted file mode 100644 index 119f536333..0000000000 --- a/tests/emb6/Makefile.ci +++ /dev/null @@ -1,21 +0,0 @@ -BOARD_INSUFFICIENT_MEMORY := \ - arduino-duemilanove \ - arduino-leonardo \ - arduino-mega2560 \ - arduino-nano \ - arduino-uno \ - atmega328p \ - i-nucleo-lrwan1 \ - msb-430 \ - msb-430h \ - nucleo-f031k6 \ - nucleo-f042k6 \ - nucleo-l031k6 \ - nucleo-l053r8 \ - stm32f030f4-demo \ - stm32f0discovery \ - stm32l0538-disco \ - telosb \ - waspmote-pro \ - z1 \ - # diff --git a/tests/emb6/common.c b/tests/emb6/common.c deleted file mode 100644 index ec50688980..0000000000 --- a/tests/emb6/common.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 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. - */ - -/** - * @{ - * - * @file - * @author Martine Lenders - */ - -#include - -#include "common.h" - -size_t hex2ints(uint8_t *out, const char *in) -{ - bool upper = true; - size_t out_size = 0; - - while (*in != '\0') { - char c; - if ((*in >= '0') && (*in <= '9')) { - c = '0'; - } - else if ((*in >= 'a') && (*in <= 'f')) { - c = 'a' - 10; - } - else if ((*in >= 'A') && (*in <= 'F')) { - c = 'A' - 10; - } - else { - in++; - continue; - } - if (upper) { - *out = (char)(*in - c) << 4; - } - else { - *out |= (char)(*in - c); - out++; - out_size++; - } - upper = !upper; - in++; - } - if (!upper) { - out_size++; - } - return out_size; -} - -/** @} */ diff --git a/tests/emb6/common.h b/tests/emb6/common.h deleted file mode 100644 index 178aa5adb0..0000000000 --- a/tests/emb6/common.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2016 Martine Lenders - * - * 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 tests - * @{ - * - * @file - * @brief Definitions for tests/emb6/ - * - * @author Martine Lenders - */ -#ifndef COMMON_H -#define COMMON_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Application configuration - * @{ - */ -#define SOCK_INBUF_SIZE (256) -#define SERVER_MSG_QUEUE_SIZE (8) -#define SERVER_BUFFER_SIZE (64) -/** - * @} - */ - -/** - * @brief Converts hex string to byte array. - * - * @param[out] out Resulting byte array - * @param[in] in `\0` terminated string. Non-hex characters (all except 0-9, a-f, A-F) - * will be ignored. - * - * @return Length of @p out. - */ -size_t hex2ints(uint8_t *out, const char *in); - -/** - * @brief Ping shell command - * - * @param[in] argc number of arguments - * @param[in] argv array of arguments - * - * @return 0 on success - * @return other on error - */ -int ping_cmd(int argc, char **argv); - -#ifdef MODULE_EMB6_SOCK_UDP -/** - * @brief UDP IP shell command - * - * @param[in] argc number of arguments - * @param[in] argv array of arguments - * - * @return 0 on success - * @return other on error - */ -int udp_cmd(int argc, char **argv); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* COMMON_H */ -/** @} */ diff --git a/tests/emb6/main.c b/tests/emb6/main.c deleted file mode 100644 index adeee367c2..0000000000 --- a/tests/emb6/main.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2015 Martine Lenders - * - * 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 examples - * @{ - * - * @file - * @brief Test for raw IPv6 connections - * - * @author Martine Lenders - * - * This test application tests the emb6_conn_ip module. - * - * @} - */ - -#include -#include - -#include "at86rf2xx.h" -#include "at86rf2xx_params.h" -#include "common.h" -#include "emb6.h" -#include "emb6/netdev.h" -#include "uip-ds6.h" -#include "net/ipv6/addr.h" -#include "shell.h" -#include "thread.h" -#include "xtimer.h" - -#define EMB6_STACKSIZE (THREAD_STACKSIZE_DEFAULT) -#define EMB6_PRIO (THREAD_PRIORITY_MAIN - 3) -#define EMB6_DELAY (500) - -static at86rf2xx_t at86rf2xx; -static s_ns_t emb6 = { - .hc = &sicslowpan_driver, - .llsec = &nullsec_driver, - .hmac = &nullmac_driver, - .lmac = &sicslowmac_driver, - .frame = &framer_802154, - .c_configured = 1, -}; -static char emb6_stack[EMB6_STACKSIZE]; - -static int ifconfig(int argc, char **argv) -{ - (void)argc; - (void)argv; - char addrstr[IPV6_ADDR_MAX_STR_LEN]; - printf("0: "); - for (int i = 0; i < UIP_DS6_ADDR_NB; i++) { - if (uip_ds6_if.addr_list[i].isused) { - printf("inet6 %s\n", - ipv6_addr_to_str(addrstr, - (ipv6_addr_t *)&uip_ds6_if.addr_list[i].ipaddr, - sizeof(addrstr))); - if (i != 0) { - printf(" "); - } - } - } - puts(""); - return 0; -} - -static void *_emb6_thread(void *args) -{ - (void)args; - - emb6_process(500); /* never stops */ - return NULL; -} - -static const shell_command_t shell_commands[] = { - { "ping6", "Send pings and receive pongs", ping_cmd }, -#ifdef MODULE_EMB6_SOCK_UDP - { "udp", "Send UDP messages and listen for messages on UDP port", udp_cmd }, -#endif - { "ifconfig", "Shows assigned IPv6 addresses", ifconfig }, - { NULL, NULL, NULL } -}; - -static char line_buf[SHELL_DEFAULT_BUFSIZE]; - -int main(void) -{ - netdev_t *netdev = (netdev_t *)&at86rf2xx; - - puts("RIOT emb6 test application"); - - at86rf2xx_setup(&at86rf2xx, at86rf2xx_params); - 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"); - shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); - - /* should be never reached */ - return 0; -} diff --git a/tests/emb6/ping.c b/tests/emb6/ping.c deleted file mode 100644 index e83f9d64e6..0000000000 --- a/tests/emb6/ping.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2015 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 examples - * @{ - * - * @file - * @brief Demonstrating the sending and receiving of UDP data over POSIX sockets. - * - * @author Martine Lenders - * - * @} - */ - -#include -#include -#include -#include -#include - -#include "byteorder.h" -#include "net/icmpv6.h" -#include "net/ipv6.h" -#include "xtimer.h" - -#include "uip.h" -#include "uip-icmp6.h" - -#include "common.h" - -#define ECHO_ID (0xd1e9) - -static struct uip_icmp6_echo_reply_notification recv_ntfy = { NULL, NULL }; -static uint16_t seq = 0; -static atomic_int received = ATOMIC_VAR_INIT(0); -static atomic_int num = ATOMIC_VAR_INIT(0); - -static bool _waiting = true; - -static inline icmpv6_echo_t *uip_icmp_buf(void) -{ - return ((icmpv6_echo_t *)&uip_buf[uip_l2_l3_hdr_len]); -} - -static inline int max_len(void) -{ - return UIP_BUFSIZE - (((uint8_t *)uip_icmp_buf()) - uip_buf) - - sizeof(icmpv6_echo_t); -} - -static int ping_send(const uip_ipaddr_t *dst, int payload_len) -{ - int len = payload_len; - icmpv6_echo_t *ping = uip_icmp_buf(); - - ping->id = byteorder_htons(ECHO_ID); - - if (payload_len > max_len()) { - puts("Payload too long for buffer."); - return -1; - } - - for (network_uint16_t *payload = (network_uint16_t *)(ping + 1); - len >= 0; - payload++, len -= 2) { - *payload = byteorder_htons(seq); - } - - ping->seq = byteorder_htons(seq++); - - uip_icmp6_send((const uip_ipaddr_t *)dst, ICMPV6_ECHO_REQ, 0, - payload_len + (sizeof(icmpv6_echo_t) - sizeof(icmpv6_hdr_t))); - - return 0; -} - -static void handle_reply(uip_ipaddr_t *source, uint8_t ttl, uint8_t *data, - uint16_t datalen) -{ - char addr_str[IPV6_ADDR_MAX_STR_LEN]; - icmpv6_echo_t *ping = (icmpv6_echo_t *)data; - - _waiting = false; - - ipv6_addr_to_str(addr_str, (ipv6_addr_t *)source, sizeof(addr_str)); - - atomic_fetch_add(&received, 1); - printf("%" PRIu16 " bytes from %s: icmp_seq=%" PRIu16 " ttl=%u quota=%i/%i\n", - datalen, addr_str, byteorder_ntohs(ping->seq), (unsigned)ttl, - atomic_load(&received), atomic_load(&num)); -} - -void usage(char *cmd) -{ - printf("usage: %s [] []\n", cmd); -} - -int ping_cmd(int argc, char **argv) -{ - ipv6_addr_t dst; - int payload_len, _num; - - if ((argc < 2) || (ipv6_addr_from_str(&dst, argv[1]) == NULL)) { - usage(argv[0]); - return 1; - } - if ((argc < 3) || ((_num = atoi(argv[2])) == 0)) { - _num = 3; - } - if ((argc < 4) || ((payload_len = atoi(argv[3])) == 0)) { - payload_len = 16; - } - atomic_store(&num, _num); - atomic_store(&received, 0); - seq = 0; - if (recv_ntfy.callback == NULL) { - uip_icmp6_echo_reply_callback_add(&recv_ntfy, handle_reply); - } - for (uint16_t i = 0; i < _num; i++) { - _waiting = true; - ping_send((uip_ipaddr_t *)&dst, payload_len); - xtimer_usleep(1000000); - if (_waiting) { - puts("Timeout"); - } - } - - return 0; -} - -/** @} */ diff --git a/tests/emb6/udp.c b/tests/emb6/udp.c deleted file mode 100644 index 10930fcd9c..0000000000 --- a/tests/emb6/udp.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2015 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 examples - * @{ - * - * @file - * @brief Demonstrating the sending and receiving of UDP data over POSIX sockets. - * - * @author Martine Lenders - * - * @} - */ - -#include -#include -#include - -#include "common.h" -#include "od.h" -#include "net/af.h" -#include "net/sock/udp.h" -#include "net/ipv6.h" -#include "thread.h" -#include "xtimer.h" - -#ifdef MODULE_EMB6_SOCK_UDP -static char sock_inbuf[SOCK_INBUF_SIZE]; -static bool server_running; -static sock_udp_t server_sock; -static char server_stack[THREAD_STACKSIZE_DEFAULT]; - -static void *_server_thread(void *args) -{ - int res; - - /* parse port */ - uint16_t port = atoi(args); - const sock_udp_ep_t server_addr = { .family = AF_INET6, - .port = port }; - if ((res = sock_udp_create(&server_sock, &server_addr, NULL, 0)) < 0) { - printf("Unable to open UDP server on port %" PRIu16 " (error code %d)\n", - port, -res); - return NULL; - } - server_running = true; - printf("Success: started UDP server on port %" PRIu16 "\n", port); - while (1) { - sock_udp_ep_t client_addr; - - if ((res = sock_udp_recv(&server_sock, sock_inbuf, sizeof(sock_inbuf), - SOCK_NO_TIMEOUT, &client_addr)) < 0) { - puts("Error on receive"); - } - else if (res == 0) { - puts("No data received"); - } - else { - char addrstr[IPV6_ADDR_MAX_STR_LEN]; - printf("Received from [%s]:%" PRIu16 ":\n", - ipv6_addr_to_str(addrstr, (ipv6_addr_t *)&client_addr.addr, - sizeof(addrstr)), client_addr.port); - od_hex_dump(sock_inbuf, res, 0); - } - } - return NULL; -} - -static int udp_send(char *addr_str, char *port_str, char *data, unsigned int num, - unsigned int delay) -{ - uint8_t byte_data[strlen(data) / 2]; - sock_udp_ep_t dst = { .family = AF_INET6 }; - size_t data_len; - - /* parse destination address */ - if (ipv6_addr_from_str((ipv6_addr_t *)&dst.addr, addr_str) == NULL) { - puts("Error: unable to parse destination address"); - return 1; - } - /* parse port */ - dst.port = atoi(port_str); - data_len = hex2ints(byte_data, data); - for (unsigned int i = 0; i < num; i++) { - if (sock_udp_send(NULL, byte_data, data_len, &dst) < 0) { - puts("could not send"); - } - else { - printf("Success: send %u byte to [%s]:%" PRIu16 ")\n", - (unsigned)data_len, addr_str, dst.port); - } - xtimer_usleep(delay); - } - return 0; -} - -static int udp_start_server(char *port_str) -{ - if (thread_create(server_stack, sizeof(server_stack), THREAD_PRIORITY_MAIN - 1, - THREAD_CREATE_STACKTEST, _server_thread, port_str, - "UDP server") <= KERNEL_PID_UNDEF) { - return 1; - } - return 0; -} - -int udp_cmd(int argc, char **argv) -{ - if (argc < 2) { - printf("usage: %s [send|server]\n", argv[0]); - return 1; - } - - if (strcmp(argv[1], "send") == 0) { - uint32_t num = 1; - uint32_t delay = 1000000; - if (argc < 5) { - printf("usage: %s send [ []]\n", - argv[0]); - return 1; - } - if (argc > 5) { - num = atoi(argv[5]); - } - if (argc > 6) { - delay = atoi(argv[6]); - } - return udp_send(argv[2], argv[3], argv[4], num, delay); - } - else if (strcmp(argv[1], "server") == 0) { - if (argc < 3) { - printf("usage: %s server [start|stop]\n", argv[0]); - return 1; - } - if (strcmp(argv[2], "start") == 0) { - if (argc < 4) { - printf("usage %s server start \n", argv[0]); - return 1; - } - return udp_start_server(argv[3]); - } - else { - puts("error: invalid command"); - return 1; - } - } - else { - puts("error: invalid command"); - return 1; - } -} -#else -typedef int dont_be_pedantic; -#endif - -/** @} */