Browse Source

tests: add test for encx24j600 driver

pr/spi.typo
Kaspar Schleiser 7 years ago
parent
commit
e8c97c5817
  1. 42
      tests/driver_encx24j600/Makefile
  2. 49
      tests/driver_encx24j600/main.c

42
tests/driver_encx24j600/Makefile

@ -0,0 +1,42 @@
export APPLICATION = driver_encx24j600
include ../Makefile.tests_common
FEATURES_REQUIRED = periph_spi periph_gpio
BOARD_INSUFFICIENT_MEMORY := msb-430h stm32f0discovery weio z1
USEMODULE += gnrc_netdev2
USEMODULE += gnrc_netdev_default
USEMODULE += auto_init_gnrc_netif
USEMODULE += encx24j600
USEMODULE += gnrc_ipv6_router_default
USEMODULE += gnrc_icmpv6_echo
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps
# lower pktbuf size
CFLAGS += -DGNRC_PKTBUF_SIZE=2048
# set board specific peripheral configurations
ifneq (,$(filter nucleo-f334,$(BOARD)))
# these settings are probably valid for PoEll-i on most nucelo boards, but
# tested only on nucleo-f334
ENC_SPI ?= SPI_0
ENC_CS ?= GPIO_PIN\(PORT_C,10\)
ENC_INT ?= GPIO_PIN\(PORT_D,2\)
endif
# fallback: set SPI bus and pins to default values
ENC_SPI ?= SPI_0
ENC_CS ?= GPIO_PIN\(0,0\)
ENC_INT ?= GPIO_PIN\(0,1\)
# export SPI and pins
CFLAGS += -DENCX24J600_SPI=$(ENC_SPI)
CFLAGS += -DENCX24J600_CS=$(ENC_CS)
CFLAGS += -DENCX24J600_INT=$(ENC_INT)
# make sure we read the local encx24j600 params file
CFLAGS += -I$(CURDIR)
include $(RIOTBASE)/Makefile.include

49
tests/driver_encx24j600/main.c

@ -0,0 +1,49 @@
/*
* Copyright (C) 2015 Freie Universität Berlin
* 2016 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 the ENCx26J600 Ethernet device driver
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Kaspar Schleiser <kaspar@schleiser.de>
*
* @}
*/
#include <stdio.h>
#include "shell.h"
#include "msg.h"
#define MAIN_QUEUE_SIZE (8U)
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
int main(void)
{
/* we need a message queue for the thread running the shell in order to
* receive potentially fast incoming networking packets */
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
puts("Test application for the encx24j600 driver\n");
puts("This test just pulls in parts of the GNRC network stack, use the\n"
"provided shell commands (i.e. ifconfig, ping6) to interact with\n"
"your encx24j600 device.\n");
/* start shell */
puts("Starting the shell now...");
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
/* should be never reached */
return 0;
}
Loading…
Cancel
Save