2016-02-05 12:52:02 +01: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
|
2016-02-05 12:52:02 +01:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Auto initialization for ethernet-over-serial module
|
|
|
|
*
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef MODULE_ETHOS
|
|
|
|
|
2017-01-18 14:48:23 +01:00
|
|
|
#include "log.h"
|
|
|
|
#include "debug.h"
|
2016-02-05 12:52:02 +01:00
|
|
|
#include "ethos.h"
|
|
|
|
#include "periph/uart.h"
|
2017-11-16 18:06:46 +01:00
|
|
|
#include "net/gnrc/netif/ethernet.h"
|
2016-02-05 12:52:02 +01:00
|
|
|
|
|
|
|
/**
|
2018-07-05 14:09:08 +02:00
|
|
|
* @brief global ethos object, used by stdio_uart
|
2016-02-05 12:52:02 +01:00
|
|
|
*/
|
|
|
|
ethos_t ethos;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define stack parameters for the MAC layer thread
|
|
|
|
* @{
|
|
|
|
*/
|
2016-09-03 02:07:03 +02:00
|
|
|
#define ETHOS_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
|
|
|
|
#ifndef ETHOS_MAC_PRIO
|
2017-11-16 18:06:46 +01:00
|
|
|
#define ETHOS_MAC_PRIO (GNRC_NETIF_PRIO)
|
2017-07-25 22:48:00 +02:00
|
|
|
#endif
|
2016-02-05 12:52:02 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Stacks for the MAC layer threads
|
|
|
|
*/
|
2017-02-15 13:07:34 +01:00
|
|
|
static char _netdev_eth_stack[ETHOS_MAC_STACKSIZE];
|
2016-02-05 12:52:02 +01:00
|
|
|
|
|
|
|
static uint8_t _inbuf[2048];
|
|
|
|
|
|
|
|
void auto_init_ethos(void)
|
|
|
|
{
|
2017-01-18 14:48:23 +01:00
|
|
|
LOG_DEBUG("[auto_init_netif] initializing ethos #0\n");
|
2016-02-05 12:52:02 +01:00
|
|
|
|
2017-02-15 13:07:34 +01:00
|
|
|
/* setup netdev device */
|
2016-03-28 22:50:12 +02:00
|
|
|
ethos_params_t p;
|
|
|
|
p.uart = ETHOS_UART;
|
|
|
|
p.baudrate = ETHOS_BAUDRATE;
|
2016-03-30 17:09:58 +02:00
|
|
|
p.buf = _inbuf;
|
|
|
|
p.bufsize = sizeof(_inbuf);
|
2016-03-28 22:50:12 +02:00
|
|
|
ethos_setup(ðos, &p);
|
2016-02-05 12:52:02 +01:00
|
|
|
|
2017-02-15 13:07:34 +01:00
|
|
|
/* initialize netdev<->gnrc adapter state */
|
2017-11-16 18:06:46 +01:00
|
|
|
gnrc_netif_ethernet_create(_netdev_eth_stack, ETHOS_MAC_STACKSIZE,
|
|
|
|
ETHOS_MAC_PRIO, "ethos", (netdev_t *)ðos);
|
2016-02-05 12:52:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
typedef int dont_be_pedantic;
|
|
|
|
#endif /* MODULE_ETHOS */
|
|
|
|
/** @} */
|