mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 18:13:49 +01:00
tests/driver_nrf802154: Initial driver test
This commit is contained in:
parent
a2ac1c86db
commit
37bdc32e30
15
tests/driver_nrf802154/Makefile
Normal file
15
tests/driver_nrf802154/Makefile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
INCLUDES += -I$(APPDIR)
|
||||||
|
BOARD ?= nrf52dk
|
||||||
|
|
||||||
|
include ../Makefile.tests_common
|
||||||
|
|
||||||
|
USEMODULE += test_utils_netdev_ieee802154_minimal
|
||||||
|
|
||||||
|
# select the driver to test
|
||||||
|
USEMODULE += nrf802154
|
||||||
|
|
||||||
|
FEATURES_REQUIRED += cpu_nrf52
|
||||||
|
|
||||||
|
CFLAGS += -DEVENT_THREAD_STACKSIZE_DEFAULT=1024
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.include
|
||||||
6
tests/driver_nrf802154/README.md
Normal file
6
tests/driver_nrf802154/README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# About
|
||||||
|
This is a manual test application for the NRF802154 radio driver.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
For testing the radio driver you can use the ifconfig and txtsnd shell commands
|
||||||
|
that are included in this application.
|
||||||
33
tests/driver_nrf802154/init_dev.h
Normal file
33
tests/driver_nrf802154/init_dev.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* 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 NRF802154 IEEE 802.15.4 device driver
|
||||||
|
*
|
||||||
|
* @author Kevin Weiss <kevin.weiss@haw-hamburg.de>
|
||||||
|
*/
|
||||||
|
#ifndef INIT_DEV_H
|
||||||
|
#define INIT_DEV_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NRF802154_NUM 1
|
||||||
|
#define NETDEV_IEEE802154_MINIMAL_NUMOF NRF802154_NUM
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* INIT_DEV_H */
|
||||||
|
/** @} */
|
||||||
72
tests/driver_nrf802154/main.c
Normal file
72
tests/driver_nrf802154/main.c
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* 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 NRF802154 IEEE 802.15.4 device driver
|
||||||
|
*
|
||||||
|
* @author Leandro Lanzieri <leandro.lanzieri@haw-hamburg.de>
|
||||||
|
*
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "nrf802154.h"
|
||||||
|
#include "init_dev.h"
|
||||||
|
#include "net/netdev/ieee802154_submac.h"
|
||||||
|
#include "shell.h"
|
||||||
|
#include "test_utils/netdev_ieee802154_minimal.h"
|
||||||
|
|
||||||
|
static netdev_ieee802154_submac_t nrf802154;
|
||||||
|
|
||||||
|
int netdev_ieee802154_minimal_init_devs(netdev_event_cb_t cb) {
|
||||||
|
netdev_t *netdev = &nrf802154.dev.netdev;
|
||||||
|
|
||||||
|
puts("Initializing NRF802154 device");
|
||||||
|
|
||||||
|
netdev_register(netdev, NETDEV_CC2538, 0);
|
||||||
|
netdev_ieee802154_submac_init(&nrf802154);
|
||||||
|
|
||||||
|
/* setup and initialize the specific driver */
|
||||||
|
nrf802154_hal_setup(&nrf802154.submac.dev);
|
||||||
|
nrf802154_init();
|
||||||
|
|
||||||
|
/* set the application-provided callback */
|
||||||
|
netdev->event_callback = cb;
|
||||||
|
|
||||||
|
/* initialize the device driver */
|
||||||
|
int res = netdev->driver->init(netdev);
|
||||||
|
if (res != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
puts("Test application for NRF802154 IEEE 802.15.4 device driver");
|
||||||
|
|
||||||
|
int res = netdev_ieee802154_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