-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/driver_nrf802154: Initial driver test
- Loading branch information
1 parent
a2ac1c8
commit 37bdc32
Showing
4 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |