1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-27 23:41:18 +01:00

tests: add SAM0 ethernet test

This commit is contained in:
Leandro Lanzieri 2022-03-03 15:36:44 +01:00
parent 5e41b51470
commit 4593746b70
No known key found for this signature in database
GPG Key ID: F4E9A721761C7593
3 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,14 @@
BOARD ?= same54-xpro
include ../Makefile.tests_common
USEMODULE += test_utils_netdev_eth_minimal
# the driver to test
USEMODULE += sam0_eth
FEATURES_REQUIRED += periph_eth
FEATURES_REQUIRED += cpu_samd5x # TODO: complete with other SAM0 CPUs that have ethernet
INCLUDES += -I$(APPDIR)
include $(RIOTBASE)/Makefile.include

View 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 SAM0 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 */
/** @} */

View File

@ -0,0 +1,64 @@
/*
* 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 SAM0 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 "sam0_eth_netdev.h"
static netdev_t sam0_eth;
int netdev_eth_minimal_init_devs(netdev_event_cb_t cb) {
/* setup the specific driver */
sam0_eth_setup(&sam0_eth);
/* set the application-provided callback */
sam0_eth.event_callback = cb;
/* initialize the device driver */
int res = sam0_eth.driver->init(&sam0_eth);
assert(!res);
return 0;
}
int main(void)
{
puts("Test application for SAM0 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;
}