mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
tests/driver_dose: rewrite without GNRC
This commit is contained in:
parent
99a974914a
commit
b3c202cc84
@ -1,3 +1,7 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += test_utils_netdev_eth_minimal
|
||||
|
||||
# the driver to test
|
||||
USEMODULE += dose
|
||||
|
||||
@ -13,4 +17,6 @@ ifneq (,$(filter same54-xpro, $(BOARD)))
|
||||
USEMODULE += dose_watchdog
|
||||
endif
|
||||
|
||||
include ../driver_netdev_common/Makefile.netdev.mk
|
||||
INCLUDES += -I$(APPDIR)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -1,30 +1,13 @@
|
||||
BOARD_INSUFFICIENT_MEMORY := \
|
||||
arduino-duemilanove \
|
||||
arduino-leonardo \
|
||||
arduino-mega2560 \
|
||||
arduino-nano \
|
||||
arduino-uno \
|
||||
atxmega-a3bu-xplained \
|
||||
atmega328p \
|
||||
atmega328p-xplained-mini \
|
||||
bluepill-stm32f030c8 \
|
||||
i-nucleo-lrwan1 \
|
||||
msb-430 \
|
||||
msb-430h \
|
||||
nucleo-f030r8 \
|
||||
nucleo-f031k6 \
|
||||
nucleo-f042k6 \
|
||||
nucleo-f303k8 \
|
||||
nucleo-f334r8 \
|
||||
nucleo-l011k4 \
|
||||
nucleo-l031k6 \
|
||||
nucleo-l053r8 \
|
||||
samd10-xmini \
|
||||
slstk3400a \
|
||||
stk3200 \
|
||||
stm32f030f4-demo \
|
||||
stm32f0discovery \
|
||||
stm32g0316-disco \
|
||||
stm32l0538-disco \
|
||||
waspmote-pro \
|
||||
#
|
||||
|
45
tests/driver_dose/init_dev.h
Normal file
45
tests/driver_dose/init_dev.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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 DOSE driver
|
||||
*
|
||||
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
||||
*/
|
||||
#ifndef INIT_DEV_H
|
||||
#define INIT_DEV_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "kernel_defines.h"
|
||||
#include "net/netdev.h"
|
||||
|
||||
#include "dose.h"
|
||||
#include "dose_params.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DOSE_NUM ARRAY_SIZE(dose_params)
|
||||
#define NETDEV_ETH_MINIMAL_NUMOF DOSE_NUM
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* INIT_DEV_H */
|
||||
/** @} */
|
@ -1 +0,0 @@
|
||||
../driver_netdev_common/main.c
|
68
tests/driver_dose/main.c
Normal file
68
tests/driver_dose/main.c
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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 DOSE driver
|
||||
*
|
||||
* @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 "dose.h"
|
||||
#include "dose_params.h"
|
||||
|
||||
static dose_t dose[DOSE_NUM];
|
||||
|
||||
int netdev_eth_minimal_init_devs(netdev_event_cb_t cb) {
|
||||
for (unsigned i = 0; i < DOSE_NUM; i ++) {
|
||||
netdev_t *device = &dose[i].netdev;
|
||||
|
||||
/* setup the specific driver */
|
||||
dose_setup(&dose[i], &dose_params[i], i);
|
||||
|
||||
/* 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 DOSE 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…
Reference in New Issue
Block a user