Merge pull request #14612 from ArwinV/openthread-kw41z

pkg/openthread: add support for kw41z radios
This commit is contained in:
José Alamos 2020-07-29 11:47:27 +02:00 committed by GitHub
commit 2f6185ee97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -4,7 +4,7 @@ APPLICATION = openthread
BOARD ?= samr21-xpro BOARD ?= samr21-xpro
# These are the boards that OpenThread stack has been tested on # These are the boards that OpenThread stack has been tested on
BOARD_WHITELIST := samr21-xpro iotlab-m3 fox iotlab-a8-m3 BOARD_WHITELIST := samr21-xpro iotlab-m3 fox iotlab-a8-m3 frdm-kw41z openlabs-kw41z-mini-256kib openlabs-kw41z-mini phynode-kw41z usb-kw41z
# This has to be the absolute path to the RIOT base directory: # This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../.. RIOTBASE ?= $(CURDIR)/../..
@ -41,6 +41,9 @@ endif
ifneq (,$(filter iotlab-m3 fox iotlab-a8-m3,$(BOARD))) ifneq (,$(filter iotlab-m3 fox iotlab-a8-m3,$(BOARD)))
DRIVER := at86rf231 DRIVER := at86rf231
endif endif
ifneq (,$(filter frdm-kw41z openlabs-kw41z-mini-256kib openlabs-kw41z-mini phynode-kw41z usb-kw41z,$(BOARD)))
DRIVER := kw41zrf
endif
USEMODULE += $(DRIVER) USEMODULE += $(DRIVER)

View File

@ -30,6 +30,10 @@
#include "at86rf2xx_params.h" #include "at86rf2xx_params.h"
#endif #endif
#ifdef MODULE_KW41ZRF
#include "kw41zrf.h"
#endif
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
@ -37,10 +41,18 @@
#define OPENTHREAD_NETIF_NUMOF ARRAY_SIZE(at86rf2xx_params) #define OPENTHREAD_NETIF_NUMOF ARRAY_SIZE(at86rf2xx_params)
#endif #endif
#ifdef MODULE_KW41ZRF
#define OPENTHREAD_NETIF_NUMOF (1U)
#endif
#ifdef MODULE_AT86RF2XX #ifdef MODULE_AT86RF2XX
static at86rf2xx_t at86rf2xx_dev; static at86rf2xx_t at86rf2xx_dev;
#endif #endif
#ifdef MODULE_KW41ZRF
static kw41zrf_t kw41z_dev;
#endif
static uint8_t rx_buf[OPENTHREAD_NETDEV_BUFLEN]; static uint8_t rx_buf[OPENTHREAD_NETDEV_BUFLEN];
static uint8_t tx_buf[OPENTHREAD_NETDEV_BUFLEN]; static uint8_t tx_buf[OPENTHREAD_NETDEV_BUFLEN];
static char ot_thread_stack[2 * THREAD_STACKSIZE_MAIN]; static char ot_thread_stack[2 * THREAD_STACKSIZE_MAIN];
@ -55,6 +67,10 @@ void openthread_bootstrap(void)
at86rf2xx_setup(&at86rf2xx_dev, &at86rf2xx_params[0]); at86rf2xx_setup(&at86rf2xx_dev, &at86rf2xx_params[0]);
netdev_t *netdev = (netdev_t *) &at86rf2xx_dev; netdev_t *netdev = (netdev_t *) &at86rf2xx_dev;
#endif #endif
#ifdef MODULE_KW41ZRF
kw41zrf_setup(&kw41z_dev);
netdev_t *netdev = (netdev_t *) &kw41z_dev;
#endif
openthread_radio_init(netdev, tx_buf, rx_buf); openthread_radio_init(netdev, tx_buf, rx_buf);
openthread_netdev_init(ot_thread_stack, sizeof(ot_thread_stack), THREAD_PRIORITY_MAIN - 5, "openthread", netdev); openthread_netdev_init(ot_thread_stack, sizeof(ot_thread_stack), THREAD_PRIORITY_MAIN - 5, "openthread", netdev);