mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
tests: add STM32 ethernet test
This commit is contained in:
parent
4593746b70
commit
32d8c864e7
15
tests/driver_stm32_eth/Makefile
Normal file
15
tests/driver_stm32_eth/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
BOARD ?= nucleo-f207zg
|
||||
|
||||
INCLUDES += -I$(APPDIR)
|
||||
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += test_utils_netdev_eth_minimal
|
||||
|
||||
# the driver to test
|
||||
USEMODULE += stm32_eth
|
||||
|
||||
FEATURES_REQUIRED += periph_eth
|
||||
FEATURES_REQUIRED += cpu_stm32
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
36
tests/driver_stm32_eth/init_dev.h
Normal file
36
tests/driver_stm32_eth/init_dev.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2022 HAW Hamburg
|
||||
*
|
||||
* 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 Device-specific test header file STM32 ethernet peripheral driver
|
||||
*
|
||||
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
||||
*/
|
||||
#ifndef INIT_DEV_H
|
||||
#define INIT_DEV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NETDEV_ETH_MINIMAL_NUMOF 1
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* INIT_DEV_H */
|
||||
/** @} */
|
||||
62
tests/driver_stm32_eth/main.c
Normal file
62
tests/driver_stm32_eth/main.c
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2022 HAW Hamburg
|
||||
*
|
||||
* 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 STM32 ethernet peripheral driver
|
||||
*
|
||||
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "assert.h"
|
||||
#include "stm32_eth.h"
|
||||
#include "test_utils/netdev_eth_minimal.h"
|
||||
|
||||
static netdev_t stm32_eth;
|
||||
|
||||
int netdev_eth_minimal_init_devs(netdev_event_cb_t cb) {
|
||||
|
||||
/* setup the specific driver */
|
||||
stm32_eth_netdev_setup(&stm32_eth);
|
||||
|
||||
/* set the application-provided callback */
|
||||
stm32_eth.event_callback = cb;
|
||||
|
||||
/* initialize the device driver */
|
||||
int res = stm32_eth.driver->init(&stm32_eth);
|
||||
assert(!res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
puts("Test application for STM32 ethernet peripheral driver");
|
||||
|
||||
int res = netdev_eth_minimal_init();
|
||||
if (res) {
|
||||
puts("Error initializing devices");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* start the shell */
|
||||
puts("Initialization successful - starting the shell now");
|
||||
|
||||
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user