2016-12-31 12:24:28 +01: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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2018-06-06 10:32:32 +02:00
|
|
|
* @ingroup sys_auto_init_gnrc_netif
|
2016-12-31 12:24:28 +01:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Auto initialization for mrf24j40 network interfaces
|
|
|
|
*
|
|
|
|
* @author Neo Nenaco <neo@nenaco.de>
|
|
|
|
*/
|
|
|
|
|
2017-01-30 15:11:28 +01:00
|
|
|
#include "log.h"
|
2016-12-31 12:24:28 +01:00
|
|
|
#include "board.h"
|
2017-11-16 18:06:46 +01:00
|
|
|
#include "net/gnrc/netif/ieee802154.h"
|
2016-12-31 12:24:28 +01:00
|
|
|
#include "net/gnrc.h"
|
2020-11-22 23:50:51 +01:00
|
|
|
#include "include/init_devs.h"
|
2016-12-31 12:24:28 +01:00
|
|
|
|
|
|
|
#include "mrf24j40.h"
|
|
|
|
#include "mrf24j40_params.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define stack parameters for the MAC layer thread
|
|
|
|
* @{
|
|
|
|
*/
|
2020-11-22 23:50:51 +01:00
|
|
|
#define MRF24J40_MAC_STACKSIZE (IEEE802154_STACKSIZE_DEFAULT)
|
2016-12-31 12:24:28 +01:00
|
|
|
#ifndef MRF24J40_MAC_PRIO
|
2017-11-16 18:06:46 +01:00
|
|
|
#define MRF24J40_MAC_PRIO (GNRC_NETIF_PRIO)
|
2017-07-25 20:28:13 +02:00
|
|
|
#endif
|
2016-12-31 12:24:28 +01:00
|
|
|
|
2019-07-18 15:16:43 +02:00
|
|
|
#define MRF24J40_NUM ARRAY_SIZE(mrf24j40_params)
|
2016-12-31 12:24:28 +01:00
|
|
|
|
|
|
|
static mrf24j40_t mrf24j40_devs[MRF24J40_NUM];
|
|
|
|
static char _mrf24j40_stacks[MRF24J40_NUM][MRF24J40_MAC_STACKSIZE];
|
|
|
|
|
2019-12-19 19:23:15 +01:00
|
|
|
static gnrc_netif_t _netif[MRF24J40_NUM];
|
|
|
|
|
2016-12-31 12:24:28 +01:00
|
|
|
void auto_init_mrf24j40(void)
|
|
|
|
{
|
|
|
|
for (unsigned i = 0; i < MRF24J40_NUM; i++) {
|
2017-01-30 15:11:28 +01:00
|
|
|
LOG_DEBUG("[auto_init_netif] initializing mrf24j40 #%u\n", i);
|
|
|
|
|
2020-09-04 14:20:38 +02:00
|
|
|
mrf24j40_setup(&mrf24j40_devs[i], &mrf24j40_params[i], i);
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_ieee802154_create(&_netif[i], _mrf24j40_stacks[i],
|
2017-11-16 18:06:46 +01:00
|
|
|
MRF24J40_MAC_STACKSIZE, MRF24J40_MAC_PRIO,
|
|
|
|
"mrf24j40",
|
2021-06-22 15:52:45 +02:00
|
|
|
&mrf24j40_devs[i].netdev.netdev);
|
2016-12-31 12:24:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/** @} */
|