2021-08-14 18:46:17 +02:00
|
|
|
/*
|
2022-07-22 14:11:19 +02:00
|
|
|
* Copyright (C) 2017 Neo Nenaco <neo@nenaco.de>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
2021-08-14 18:46:17 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup sys_auto_init_lwip_netif
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Auto initialization for MRF24J40 network interfaces
|
|
|
|
*
|
|
|
|
* @author Neo Nenaco <neo@nenaco.de>
|
|
|
|
* @author Erik Ekman <eekman@google.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mrf24j40.h"
|
|
|
|
#include "mrf24j40_params.h"
|
|
|
|
|
2022-07-22 14:11:19 +02:00
|
|
|
#include "bhp/event.h"
|
|
|
|
#include "lwip.h"
|
2021-08-14 18:46:17 +02:00
|
|
|
#include "lwip_init_devs.h"
|
2022-08-16 17:28:05 +02:00
|
|
|
#include "net/netdev/ieee802154_submac.h"
|
2021-08-14 18:46:17 +02:00
|
|
|
|
|
|
|
#define ENABLE_DEBUG 0
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#define NETIF_MRF24J40_NUMOF ARRAY_SIZE(mrf24j40_params)
|
|
|
|
|
2021-10-08 18:59:32 +02:00
|
|
|
static lwip_netif_t netif[NETIF_MRF24J40_NUMOF];
|
2021-08-14 18:46:17 +02:00
|
|
|
static mrf24j40_t mrf24j40_devs[NETIF_MRF24J40_NUMOF];
|
2022-08-16 17:28:05 +02:00
|
|
|
static netdev_ieee802154_submac_t mrf24j40_netdev[NETIF_MRF24J40_NUMOF];
|
2021-08-14 18:46:17 +02:00
|
|
|
|
2021-08-20 14:48:41 +02:00
|
|
|
static void auto_init_mrf24j40(void)
|
2021-08-14 18:46:17 +02:00
|
|
|
{
|
|
|
|
for (unsigned i = 0; i < NETIF_MRF24J40_NUMOF; i++) {
|
2022-07-22 14:11:19 +02:00
|
|
|
bhp_event_init(&netif[i].bhp, &lwip_event_queue, &mrf24j40_radio_irq_handler,
|
|
|
|
&mrf24j40_netdev[i].submac.dev);
|
2022-08-16 17:28:05 +02:00
|
|
|
mrf24j40_init(&mrf24j40_devs[i], &mrf24j40_params[i], &mrf24j40_netdev[i].submac.dev,
|
2022-07-22 14:11:19 +02:00
|
|
|
bhp_event_isr_cb, &netif[i].bhp);
|
2022-08-16 17:28:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
netdev_register(&mrf24j40_netdev[i].dev.netdev, NETDEV_MRF24J40, i);
|
|
|
|
netdev_ieee802154_submac_init(&mrf24j40_netdev[i]);
|
|
|
|
|
|
|
|
if (lwip_add_6lowpan(&netif[i], &mrf24j40_netdev[i].dev.netdev) == NULL) {
|
2021-08-14 18:46:17 +02:00
|
|
|
DEBUG("Could not add mrf24j40 device\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-20 14:48:41 +02:00
|
|
|
|
|
|
|
LWIP_INIT_6LOWPAN_NETIF(auto_init_mrf24j40);
|
2021-08-14 18:46:17 +02:00
|
|
|
/** @} */
|