2015-05-08 15:50:35 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.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
|
2015-05-08 15:50:35 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
2016-03-28 23:00:50 +02:00
|
|
|
* @brief Auto initialization for at86rf2xx network interfaces
|
2015-05-08 15:50:35 +02:00
|
|
|
*
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*/
|
|
|
|
|
2017-01-18 14:48:23 +01:00
|
|
|
#include "log.h"
|
2015-05-08 15:50:35 +02:00
|
|
|
#include "board.h"
|
2017-11-16 18:06:46 +01:00
|
|
|
#include "net/gnrc/netif/ieee802154.h"
|
2017-11-29 14:44:30 +01:00
|
|
|
#ifdef MODULE_GNRC_LWMAC
|
2017-01-31 17:25:32 +01:00
|
|
|
#include "net/gnrc/lwmac/lwmac.h"
|
2017-11-29 14:44:30 +01:00
|
|
|
#endif
|
2016-04-10 20:17:45 +02:00
|
|
|
#ifdef MODULE_GNRC_GOMACH
|
|
|
|
#include "net/gnrc/gomach/gomach.h"
|
|
|
|
#endif
|
2015-08-10 02:41:08 +02:00
|
|
|
#include "net/gnrc.h"
|
2015-05-08 15:50:35 +02:00
|
|
|
|
2015-08-09 21:24:55 +02:00
|
|
|
#include "at86rf2xx.h"
|
|
|
|
#include "at86rf2xx_params.h"
|
2015-05-08 15:50:35 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define stack parameters for the MAC layer thread
|
|
|
|
* @{
|
|
|
|
*/
|
2015-04-28 20:02:05 +02:00
|
|
|
#define AT86RF2XX_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
|
2016-09-03 02:07:03 +02:00
|
|
|
#ifndef AT86RF2XX_MAC_PRIO
|
2017-11-16 18:06:46 +01:00
|
|
|
#define AT86RF2XX_MAC_PRIO (GNRC_NETIF_PRIO)
|
2017-07-25 20:28:13 +02:00
|
|
|
#endif
|
2015-05-08 15:50:35 +02:00
|
|
|
|
2019-07-18 15:16:43 +02:00
|
|
|
#define AT86RF2XX_NUM ARRAY_SIZE(at86rf2xx_params)
|
2015-05-08 15:50:35 +02:00
|
|
|
|
2015-08-09 21:24:55 +02:00
|
|
|
static at86rf2xx_t at86rf2xx_devs[AT86RF2XX_NUM];
|
2019-12-19 19:23:15 +01:00
|
|
|
static gnrc_netif_t _netif[AT86RF2XX_NUM];
|
2017-01-10 13:57:47 +01:00
|
|
|
static char _at86rf2xx_stacks[AT86RF2XX_NUM][AT86RF2XX_MAC_STACKSIZE];
|
2015-05-08 15:50:35 +02:00
|
|
|
|
2015-08-09 21:24:55 +02:00
|
|
|
void auto_init_at86rf2xx(void)
|
2015-05-08 15:50:35 +02:00
|
|
|
{
|
2015-11-28 12:46:30 +01:00
|
|
|
for (unsigned i = 0; i < AT86RF2XX_NUM; i++) {
|
2017-01-18 14:48:23 +01:00
|
|
|
LOG_DEBUG("[auto_init_netif] initializing at86rf2xx #%u\n", i);
|
|
|
|
|
2017-01-30 15:10:27 +01:00
|
|
|
at86rf2xx_setup(&at86rf2xx_devs[i], &at86rf2xx_params[i]);
|
2016-04-10 20:17:45 +02:00
|
|
|
#if defined(MODULE_GNRC_GOMACH)
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_gomach_create(&_netif[i], _at86rf2xx_stacks[i],
|
2016-04-10 20:17:45 +02:00
|
|
|
AT86RF2XX_MAC_STACKSIZE,
|
|
|
|
AT86RF2XX_MAC_PRIO, "at86rf2xx-gomach",
|
|
|
|
(netdev_t *)&at86rf2xx_devs[i]);
|
|
|
|
#elif defined(MODULE_GNRC_LWMAC)
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_lwmac_create(&_netif[i], _at86rf2xx_stacks[i],
|
2017-11-16 18:06:46 +01:00
|
|
|
AT86RF2XX_MAC_STACKSIZE,
|
|
|
|
AT86RF2XX_MAC_PRIO, "at86rf2xx-lwmac",
|
|
|
|
(netdev_t *)&at86rf2xx_devs[i]);
|
2017-10-19 19:40:58 +02:00
|
|
|
#else
|
2019-12-19 19:23:15 +01:00
|
|
|
gnrc_netif_ieee802154_create(&_netif[i], _at86rf2xx_stacks[i],
|
2017-11-16 18:06:46 +01:00
|
|
|
AT86RF2XX_MAC_STACKSIZE,
|
|
|
|
AT86RF2XX_MAC_PRIO, "at86rf2xx",
|
|
|
|
(netdev_t *)&at86rf2xx_devs[i]);
|
2017-07-25 20:28:13 +02:00
|
|
|
#endif
|
2015-05-08 15:50:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/** @} */
|