tests: add ZEP test application
This commit is contained in:
parent
c5318336ae
commit
d96f23fafd
46
tests/zep/Makefile
Normal file
46
tests/zep/Makefile
Normal file
@ -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
|
||||||
76
tests/zep/main.c
Normal file
76
tests/zep/main.c
Normal file
@ -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 <hauke.petersen@fu-berlin.de>
|
||||||
|
*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user