mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests: add ESP ethernet test
This commit is contained in:
parent
348bc9af82
commit
5e41b51470
14
tests/driver_esp_eth/Makefile
Normal file
14
tests/driver_esp_eth/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
BOARD ?= esp32-ethernet-kit-v1_0
|
||||
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += test_utils_netdev_eth_minimal
|
||||
|
||||
# the driver to test
|
||||
USEMODULE += esp_eth
|
||||
FEATURES_REQUIRED += arch_esp32
|
||||
FEATURES_REQUIRED += periph_eth
|
||||
|
||||
INCLUDES += -I$(APPDIR)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
36
tests/driver_esp_eth/init_dev.h
Normal file
36
tests/driver_esp_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 ESP ethernet peripheral
|
||||
*
|
||||
* @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 */
|
||||
/** @} */
|
67
tests/driver_esp_eth/main.c
Normal file
67
tests/driver_esp_eth/main.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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 ESP ethernet peripheral
|
||||
*
|
||||
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "test_utils/netdev_eth_minimal.h"
|
||||
#include "init_dev.h"
|
||||
#include "assert.h"
|
||||
#include "net/netdev.h"
|
||||
#include "esp_eth_netdev.h"
|
||||
#include "esp_eth_params.h"
|
||||
|
||||
extern void esp_eth_setup(esp_eth_netdev_t* dev);
|
||||
extern esp_eth_netdev_t _esp_eth_dev;
|
||||
|
||||
int netdev_eth_minimal_init_devs(netdev_event_cb_t cb) {
|
||||
netdev_t *device = &_esp_eth_dev.netdev;
|
||||
|
||||
/* setup the specific driver */
|
||||
esp_eth_setup(&_esp_eth_dev);
|
||||
|
||||
/* set the application-provided callback */
|
||||
device->event_callback = cb;
|
||||
|
||||
/* initialize the device driver */
|
||||
int res = device->driver->init(device);
|
||||
assert(!res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
puts("Test application for ESP ethernet peripheral");
|
||||
|
||||
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…
Reference in New Issue
Block a user