Skip to content
Snippets Groups Projects
Commit 7a80d315 authored by Kaspar Schleiser's avatar Kaspar Schleiser
Browse files

sys: auto_init: add auto initialization for dev_eth

parent fbfb0954
Branches
No related tags found
No related merge requests found
...@@ -12,4 +12,8 @@ ifneq (,$(filter auto_init_ng_netif,$(USEMODULE))) ...@@ -12,4 +12,8 @@ ifneq (,$(filter auto_init_ng_netif,$(USEMODULE)))
DIRS += netif DIRS += netif
endif endif
ifneq (,$(filter dev_eth_autoinit,$(USEMODULE)))
DIRS += $(RIOTBASE)/sys/auto_init/dev_eth
endif
include $(RIOTBASE)/Makefile.base include $(RIOTBASE)/Makefile.base
...@@ -103,6 +103,11 @@ ...@@ -103,6 +103,11 @@
#include "net/ng_udp.h" #include "net/ng_udp.h"
#endif #endif
#ifdef MODULE_DEV_ETH_AUTOINIT
#include "net/dev_eth.h"
#include "dev_eth_autoinit.h"
#endif
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
......
MODULE = dev_eth_autoinit
include $(RIOTBASE)/Makefile.base
/*
* 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.
*/
#include "net/dev_eth.h"
#include "dev_eth_autoinit.h"
#ifdef MODULE_NG_NATIVENET
#include "dev_eth_tap.h"
#endif
#ifdef MODULE_ENCX24J600
#include "encx24j600.h"
encx24j600_t dev_eth_encx24j600;
#endif
dev_eth_t * const dev_eth_devices[] = {
#ifdef MODULE_NG_NATIVENET
[DEV_ETH_TAP] = (dev_eth_t*)&dev_eth_tap,
#endif
#ifdef MODULE_ENCX24J600
[DEV_ETH_ENCX24J600] = (dev_eth_t*)&dev_eth_encx24j600,
#endif
};
void dev_eth_autoinit(void)
{
#ifdef MODULE_ENCX24J600
/* TODO: use sensible defines */
encx24j600_setup(&dev_eth_encx24j600, SPI_0, GPIO_1, GPIO_2);
#endif
}
/*
* 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.
*/
/**
* @defgroup sys_net_dev_eth dev_eth auto setup
* @ingroup sys_net_eth
* @file
* @brief Automatically setup available ethernet devices
* @{
*
* @brief header for dev_eth automatic initialization
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#ifndef DEV_ETH_AUTOINIT_H
#define DEV_ETH_AUTOINIT_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief enum for available ethernet devices
*/
enum {
#ifdef MODULE_NG_NATIVENET
DEV_ETH_TAP,
#endif
#ifdef MODULE_ENCX24J600
DEV_ETH_ENCX24J600,
#endif
/* must be last: */
NUM_DEV_ETH
};
/**
* @brief Array of const pointers to available ethernet devices
*/
extern dev_eth_t *const dev_eth_devices[];
/**
* @brief Automatically sets up available dev_eth ethernet devices
*
* ... by calling the respective *_setup() functions if available.
*/
void dev_eth_autoinit(void);
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* DEV_ETH_AUTOINIT_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment