1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 23:11:19 +01:00

tests/ieee802154_hal: add support for kw2xrf radios

Co-authored-by: Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
This commit is contained in:
Jose Alamos 2022-07-28 18:28:37 +02:00
parent 4ebcd7c055
commit f1ca73e934
No known key found for this signature in database
GPG Key ID: F483EB800EF89DD9
4 changed files with 35 additions and 1 deletions

View File

@ -16,6 +16,7 @@ BOARD_WHITELIST := \
remote-pa \
remote-reva \
remote-revb \
pba-d-01-kw2x \
#
DISABLE_MODULE += auto_init_at86rf2xx auto_init_nrf802154
@ -45,3 +46,7 @@ USEMODULE += netdev_default
CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE=1024
include $(RIOTBASE)/Makefile.include
ifneq (,$(filter bhp,$(USEMODULE)))
USEMODULE += bhp_event
endif

View File

@ -27,7 +27,8 @@
#define RADIOS_NUMOF IS_USED(MODULE_CC2538_RF) + \
IS_USED(MODULE_NRF802154) + \
SOCKET_ZEP_MAX
SOCKET_ZEP_MAX + \
IS_USED(MODULE_KW2XRF)
#if RADIOS_NUMOF == 0
#error "Radio is not supported"
@ -46,6 +47,7 @@ typedef enum {
IEEE802154_DEV_TYPE_CC2538_RF,
IEEE802154_DEV_TYPE_NRF802154,
IEEE802154_DEV_TYPE_SOCKET_ZEP,
IEEE802154_DEV_TYPE_KW2XRF,
} ieee802154_dev_type_t;
typedef ieee802154_dev_t* (*ieee802154_dev_cb_t)(ieee802154_dev_type_t type,

View File

@ -22,6 +22,7 @@
#include "kernel_defines.h"
#include "net/ieee802154/radio.h"
#include "common.h"
#include "bhp/event.h"
#ifdef MODULE_CC2538_RF
#include "cc2538_rf.h"
@ -36,6 +37,17 @@
#include "socket_zep_params.h"
#endif
#ifdef MODULE_KW2XRF
#include "kw2xrf.h"
#include "kw2xrf_params.h"
#include "event/thread.h"
#define KW2XRF_NUM ARRAY_SIZE(kw2xrf_params)
extern void auto_init_event_thread(void);
static kw2xrf_t kw2xrf_dev[KW2XRF_NUM];
static bhp_event_t kw2xrf_bhp[KW2XRF_NUM];
#endif
void ieee802154_hal_test_init_devs(ieee802154_dev_cb_t cb, void *opaque)
{
/* Call the init function of the device (this should be handled by
@ -56,6 +68,18 @@ void ieee802154_hal_test_init_devs(ieee802154_dev_cb_t cb, void *opaque)
}
#endif
#ifdef MODULE_KW2XRF
auto_init_event_thread();
if ((radio = cb(IEEE802154_DEV_TYPE_KW2XRF, opaque)) ){
for (unsigned i = 0; i < KW2XRF_NUM; i++) {
const kw2xrf_params_t *p = &kw2xrf_params[i];
bhp_event_init(&kw2xrf_bhp[i], EVENT_PRIO_HIGHEST, &kw2xrf_radio_hal_irq_handler, radio);
kw2xrf_init(&kw2xrf_dev[i], p, radio, bhp_event_isr_cb, &kw2xrf_bhp[i]);
break;
}
}
#endif
#ifdef MODULE_SOCKET_ZEP
static socket_zep_t _socket_zeps[SOCKET_ZEP_MAX];
if ((radio = cb(IEEE802154_DEV_TYPE_SOCKET_ZEP, opaque)) ){

View File

@ -262,6 +262,9 @@ static ieee802154_dev_t *_reg_callback(ieee802154_dev_type_t type, void *opaque)
case IEEE802154_DEV_TYPE_SOCKET_ZEP:
printf("socket_zep");
break;
case IEEE802154_DEV_TYPE_KW2XRF:
printf("kw2xrf");
break;
}
puts(".");