2015-08-26 10:21:26 +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-08-26 10:21:26 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Auto initialization for cc110x network interfaces
|
|
|
|
*
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef MODULE_CC110X
|
|
|
|
|
2017-01-18 14:48:23 +01:00
|
|
|
#include "log.h"
|
|
|
|
#include "debug.h"
|
2015-08-26 10:21:26 +02:00
|
|
|
#include "board.h"
|
2017-11-16 18:06:46 +01:00
|
|
|
#include "gnrc_netif_cc110x.h"
|
2017-07-26 13:35:14 +02:00
|
|
|
#include "cc110x-netdev.h"
|
2015-08-26 10:21:26 +02:00
|
|
|
#include "net/gnrc.h"
|
|
|
|
|
|
|
|
#include "cc110x.h"
|
|
|
|
#include "cc110x_params.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define stack parameters for the MAC layer thread
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
|
2016-09-03 02:07:03 +02:00
|
|
|
#ifndef CC110X_MAC_PRIO
|
2017-11-16 18:06:46 +01:00
|
|
|
#define CC110X_MAC_PRIO (GNRC_NETIF_PRIO)
|
2016-09-03 02:07:03 +02:00
|
|
|
#endif
|
2015-08-26 10:21:26 +02:00
|
|
|
|
2019-07-18 15:16:43 +02:00
|
|
|
#define CC110X_NUM ARRAY_SIZE(cc110x_params)
|
2015-08-26 10:21:26 +02:00
|
|
|
|
2017-02-15 13:07:34 +01:00
|
|
|
static netdev_cc110x_t cc110x_devs[CC110X_NUM];
|
2017-01-10 13:57:47 +01:00
|
|
|
static char _stacks[CC110X_NUM][CC110X_MAC_STACKSIZE];
|
2015-08-26 10:21:26 +02:00
|
|
|
|
|
|
|
void auto_init_cc110x(void)
|
|
|
|
{
|
2017-01-18 14:48:23 +01:00
|
|
|
for (unsigned i = 0; i < CC110X_NUM; i++) {
|
2015-08-26 10:21:26 +02:00
|
|
|
const cc110x_params_t *p = &cc110x_params[i];
|
2017-01-18 14:48:23 +01:00
|
|
|
|
|
|
|
LOG_DEBUG("[auto_init_netif] initializing cc110x #%u\n", i);
|
|
|
|
|
2017-02-15 13:07:34 +01:00
|
|
|
int res = netdev_cc110x_setup(&cc110x_devs[i], p);
|
2015-08-26 10:21:26 +02:00
|
|
|
if (res < 0) {
|
2017-01-18 14:48:23 +01:00
|
|
|
LOG_ERROR("[auto_init_netif] error initializing cc110x #%u\n", i);
|
2015-08-26 10:21:26 +02:00
|
|
|
}
|
|
|
|
else {
|
2017-11-16 18:06:46 +01:00
|
|
|
gnrc_netif_cc110x_create(_stacks[i], CC110X_MAC_STACKSIZE,
|
|
|
|
CC110X_MAC_PRIO, "cc110x",
|
|
|
|
(netdev_t *)&cc110x_devs[i]);
|
2015-08-26 10:21:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
typedef int dont_be_pedantic;
|
|
|
|
#endif /* MODULE_CC110X */
|
|
|
|
|
|
|
|
/** @} */
|