1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/net/gnrc/netif/init_devs/auto_init_at86rf2xx.c

74 lines
2.2 KiB
C
Raw Normal View History

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