Skip to content
Snippets Groups Projects
Commit 4e5a6752 authored by Kaspar Schleiser's avatar Kaspar Schleiser
Browse files

tests: remove obsolete ethernet tests

parent ef972735
No related branches found
No related tags found
No related merge requests found
APPLICATION = dev_eth
include ../Makefile.tests_common
BOARD_WHITELIST = native
FEATURES_REQUIRED += ethernet
ifneq (,$(filter native,$(BOARD)))
USEMODULE += dev_eth_tap
endif
USEMODULE += dev_eth_autoinit
include $(RIOTBASE)/Makefile.include
/*
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
* Ell-i open source co-operative
*
* 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 dev_eth low level ethernet drivers
*
* This test application will bounce back every received l2 ethernet
* frame by exchanging target and destination MAC addresses.
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*
* @}
*/
#include <stdio.h>
#include <string.h>
#include "thread.h"
#include "board.h"
#include "vtimer.h"
#include "periph/spi.h"
#include "periph/gpio.h"
#include "net/dev_eth.h"
#include "dev_eth_autoinit.h"
#define ENABLE_DEBUG 0
#include "debug.h"
kernel_pid_t handler_pid = KERNEL_PID_UNDEF;
char _rxbuf[2000];
/* reverse src/dst addresses in raw ethernet packet */
void turn_packet(char *pkt) {
uint8_t mac[6];
/* save old dst addr */
memcpy(mac, pkt, 6);
/* use sender MAC address as new destination */
memcpy(pkt, pkt+6, 6);
/* set our MAC address as sender */
memcpy(pkt+6, mac, 6);
}
void dev_eth_isr(dev_eth_t *dev) {
(void)dev;
thread_wakeup(handler_pid);
}
void dev_eth_rx_handler(dev_eth_t *dev) {
DEBUG("dev_eth_rx_handler dev=0x%08x\n", (unsigned) dev);
int n = dev->driver->recv(dev, _rxbuf, sizeof(_rxbuf));
DEBUG("handle_incoming: received %i bytes\n", n);
if (n>0) {
turn_packet(_rxbuf);
dev->driver->send(dev, _rxbuf, n);
}
}
void dev_eth_linkstate_handler(dev_eth_t *dev, int newstate)
{
DEBUG("dev_eth: dev=0x%08x link %s\n", (unsigned)dev, newstate ? "UP" : "DOWN");
(void)dev; (void)newstate;
}
int main(void)
{
handler_pid = thread_getpid();
/* always use first ethernet device for test */
dev_eth_t *const dev = dev_eth_devices[0];
dev_eth_init(dev);
while(1) {
dev->driver->isr(dev);
thread_sleep();
DEBUG("main: woke up\n");
}
return 0;
}
APPLICATION = driver_netdev_eth
include ../Makefile.tests_common
BOARD_WHITELIST := native
USEMODULE += dev_eth_tap
USEMODULE += gnrc
USEMODULE += gnrc_nomac
USEMODULE += gnrc_pktdump
USEMODULE += gnrc_netdev_eth
USEMODULE += auto_init_gnrc_netif
USEMODULE += shell
USEMODULE += shell_commands
include $(RIOTBASE)/Makefile.include
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
* Kaspar Schleiser <kaspar@schleiser.de>
*
* 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 netdev ethernet device driver
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
* Kaspar Schleiser <kaspar@schleiser.de>
*
* @}
*/
#include <stdio.h>
#include "board.h"
#include "kernel.h"
#include "shell.h"
#include "shell_commands.h"
#include "net/gnrc.h"
#include "net/gnrc/nomac.h"
#include "net/gnrc/pktdump.h"
#include "net/gnrc/netdev_eth.h"
#include "net/dev_eth.h"
#include "dev_eth_tap.h"
/**
* @brief Maybe you are a golfer?!
*/
int main(void)
{
gnrc_netreg_entry_t dump;
puts("netdev ethernet device driver test");
/* initialize and register pktdump */
dump.pid = gnrc_pktdump_init();
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
if (dump.pid <= KERNEL_PID_UNDEF) {
puts("Error starting pktdump thread");
return -1;
}
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
/* start the shell */
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment