diff --git a/tests/zep/Makefile b/tests/zep/Makefile new file mode 100644 index 0000000000..23bbf96590 --- /dev/null +++ b/tests/zep/Makefile @@ -0,0 +1,46 @@ +APPLICATION = zep +include ../Makefile.tests_common + +# though it would work in theory on other boards I'm currently not willing/to +# time-constraint to put effort into this for other boards. +BOARD_WHITELIST = native + +USEMODULE += ng_zep +USEMODULE += ng_netif_default +USEMODULE += auto_init_ng_netif +USEMODULE += ng_ipv6_default +USEMODULE += ng_nomac +USEMODULE += ng_pktdump +USEMODULE += shell +USEMODULE += shell_commands + +ifeq (,$(ZEP_DST)) + # set default + CFLAGS += -DZEP_DST="\"::1\"" +else + CFLAGS += -DZEP_DST="\"$(ZEP_DST)\"" +endif + +ifeq (,$(ZEP_SRC_PORT)) + # set default + CFLAGS += -DZEP_SRC_PORT=NG_ZEP_DEFAULT_PORT +else + CFLAGS += -DZEP_SRC_PORT=$(ZEP_SRC_PORT) +endif + +ifeq (,$(ZEP_DST_PORT)) + # set default + CFLAGS += -DZEP_DST_PORT=NG_ZEP_DEFAULT_PORT +else + CFLAGS += -DZEP_DST_PORT=$(ZEP_DST_PORT) +endif + +# add current directory to the include path. Putting it in CFLAGS will make +# it go to the beginning, before the standard includes. +# That way xbee_params.h get's included and auto configuration can pick it up. +CFLAGS += -I$(CURDIR) + +# one for ng_netif_default and one for ZEP +CFLAGS += -DNG_NETIF_NUMOF=2 + +include $(RIOTBASE)/Makefile.include diff --git a/tests/zep/main.c b/tests/zep/main.c new file mode 100644 index 0000000000..2f7343f489 --- /dev/null +++ b/tests/zep/main.c @@ -0,0 +1,76 @@ +/* + * 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 tests + * @{ + * + * @file + * @brief Test application for ZEP module + * + * @author Hauke Petersen + * + * @} + */ + +#include + +#include "shell.h" +#include "shell_commands.h" +#include "net/ng_netbase.h" +#include "net/ng_pktdump.h" + +/** + * @brief Buffer size used by the shell + */ +#define SHELL_BUFSIZE (64U) + +/** + * @brief Read chars from STDIO + */ +int shell_read(void) +{ + return (int)getchar(); +} + +/** + * @brief Write chars to STDIO + */ +void shell_put(int c) +{ + putchar((char)c); +} + +/** + * @brief Maybe you are a golfer?! + */ +int main(void) +{ + shell_t shell; + ng_netreg_entry_t dump; + + puts("ZEP module test"); + + /* initialize and register pktdump */ + dump.pid = ng_pktdump_getpid(); + + if (dump.pid <= KERNEL_PID_UNDEF) { + puts("Error starting pktdump thread"); + return -1; + } + + dump.demux_ctx = NG_NETREG_DEMUX_CTX_ALL; + ng_netreg_register(NG_NETTYPE_NETIF, &dump); + + /* start the shell */ + puts("Initialization OK, starting shell now"); + shell_init(&shell, NULL, SHELL_BUFSIZE, getchar, putchar); + shell_run(&shell); + + return 0; +}