2015-04-08 19:54:00 +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-04-08 19:54:00 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Auto initialization for ENCx24j600 ethernet devices
|
|
|
|
*
|
|
|
|
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
|
|
|
*/
|
|
|
|
|
2017-01-18 14:48:23 +01:00
|
|
|
#include "log.h"
|
2015-04-08 19:54:00 +02:00
|
|
|
#include "debug.h"
|
|
|
|
#include "encx24j600.h"
|
2022-03-03 14:10:33 +01:00
|
|
|
#include "encx24j600_params.h"
|
2017-11-16 18:06:46 +01:00
|
|
|
#include "net/gnrc/netif/ethernet.h"
|
2015-04-08 19:54:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Define stack parameters for the MAC layer thread
|
|
|
|
* @{
|
|
|
|
*/
|
2016-09-03 02:07:03 +02:00
|
|
|
#define ENCX24J600_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
|
|
|
|
#ifndef ENCX24J600_MAC_PRIO
|
2017-11-16 18:06:46 +01:00
|
|
|
#define ENCX24J600_MAC_PRIO (GNRC_NETIF_PRIO)
|
2017-07-25 22:48:00 +02:00
|
|
|
#endif
|
2015-04-08 19:54:00 +02:00
|
|
|
|
2022-03-03 14:10:33 +01:00
|
|
|
/**
|
|
|
|
* @brief Find out how many of these devices are present
|
|
|
|
*/
|
|
|
|
#define ENCX24J600_NUM ARRAY_SIZE(encx24j600_params)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Allocate device descriptors.
|
|
|
|
*/
|
|
|
|
static encx24j600_t encx24j600[ENCX24J600_NUM];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Allocate GNRC interfaces.
|
|
|
|
*/
|
|
|
|
static gnrc_netif_t _netif[ENCX24J600_NUM];
|
|
|
|
|
2015-04-08 19:54:00 +02:00
|
|
|
/**
|
|
|
|
* @brief Stacks for the MAC layer threads
|
|
|
|
*/
|
2022-03-03 14:10:33 +01:00
|
|
|
static char _netdev_eth_stack[ENCX24J600_NUM][ENCX24J600_MAC_STACKSIZE];
|
2015-04-08 19:54:00 +02:00
|
|
|
|
|
|
|
void auto_init_encx24j600(void)
|
|
|
|
{
|
2022-03-03 14:10:33 +01:00
|
|
|
for (unsigned i = 0; i < ENCX24J600_NUM; i++) {
|
|
|
|
LOG_DEBUG("[auto_init_netif] initializing encx24j600 #%u\n", i);
|
|
|
|
|
|
|
|
/* setup netdev device */
|
2022-03-16 15:02:25 +01:00
|
|
|
encx24j600_setup(&encx24j600[i], &encx24j600_params[i], i);
|
2022-03-03 14:10:33 +01:00
|
|
|
|
|
|
|
/* initialize netdev<->gnrc adapter state */
|
|
|
|
gnrc_netif_ethernet_create(&_netif[i], _netdev_eth_stack[i], ENCX24J600_MAC_STACKSIZE,
|
|
|
|
ENCX24J600_MAC_PRIO, "encx24j600",
|
|
|
|
&encx24j600[i].netdev);
|
|
|
|
}
|
2015-04-08 19:54:00 +02:00
|
|
|
}
|
|
|
|
/** @} */
|