2015-05-09 17:55:15 +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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-08-19 12:38:38 +02:00
|
|
|
* @ingroup auto_init_gnrc_netif
|
2015-05-09 17:55:15 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Auto initialization for XBee network interfaces
|
|
|
|
*
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*/
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
#ifdef MODULE_GNRC_SLIP
|
2015-05-09 17:55:15 +02:00
|
|
|
|
|
|
|
#include "board.h"
|
2016-09-03 02:07:03 +02:00
|
|
|
#include "net/gnrc/netdev2.h"
|
2015-08-17 15:41:29 +02:00
|
|
|
#include "net/gnrc/nomac.h"
|
2015-08-10 02:41:08 +02:00
|
|
|
#include "net/gnrc.h"
|
2015-05-09 17:55:15 +02:00
|
|
|
|
2015-06-01 16:41:03 +02:00
|
|
|
#include "net/gnrc/slip.h"
|
2015-05-09 17:55:15 +02:00
|
|
|
#include "slip_params.h"
|
|
|
|
|
|
|
|
#define ENABLE_DEBUG (0)
|
|
|
|
#include "debug.h"
|
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
#define SLIP_NUM (sizeof(gnrc_slip_params)/sizeof(gnrc_slip_params_t))
|
2015-05-09 17:55:15 +02:00
|
|
|
|
2015-08-17 15:41:29 +02:00
|
|
|
static gnrc_slip_dev_t slip_devs[SLIP_NUM];
|
2015-05-09 17:55:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define stack parameters for the MAC layer thread
|
|
|
|
* @{
|
|
|
|
*/
|
2015-06-01 16:41:03 +02:00
|
|
|
#define SLIP_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
|
2016-09-03 02:07:03 +02:00
|
|
|
#ifndef SLIP_PRIO
|
|
|
|
#define SLIP_PRIO (GNRC_NETDEV2_MAC_PRIO)
|
|
|
|
#endif
|
2015-05-09 17:55:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Stacks for the MAC layer threads
|
|
|
|
*/
|
|
|
|
static char _slip_stacks[SLIP_STACKSIZE][SLIP_NUM];
|
|
|
|
|
|
|
|
void auto_init_slip(void)
|
|
|
|
{
|
2016-03-30 12:08:43 +02:00
|
|
|
for (unsigned int i = 0; i < SLIP_NUM; i++) {
|
2015-08-17 15:41:29 +02:00
|
|
|
const gnrc_slip_params_t *p = &gnrc_slip_params[i];
|
2015-05-09 17:55:15 +02:00
|
|
|
DEBUG("Initializing SLIP radio at UART_%d\n", p->uart);
|
2015-08-17 15:41:29 +02:00
|
|
|
kernel_pid_t res = gnrc_slip_init(&slip_devs[i], p->uart, p->baudrate,
|
|
|
|
_slip_stacks[i], SLIP_STACKSIZE,
|
|
|
|
SLIP_PRIO);
|
2015-05-09 17:55:15 +02:00
|
|
|
|
|
|
|
if (res <= KERNEL_PID_UNDEF) {
|
2015-06-01 16:41:03 +02:00
|
|
|
DEBUG("Error initializing SLIP radio device!\n");
|
2015-05-09 17:55:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-27 21:52:49 +02:00
|
|
|
#else
|
|
|
|
typedef int dont_be_pedantic;
|
2015-08-17 15:41:29 +02:00
|
|
|
#endif /* MODULE_GNRC_SLIP */
|
2015-05-09 17:55:15 +02:00
|
|
|
/** @} */
|