diff --git a/sys/net/gnrc/netif/init_devs/auto_init_sam0_eth.c b/sys/net/gnrc/netif/init_devs/auto_init_sam0_eth.c new file mode 100644 index 0000000000..1b1d743dff --- /dev/null +++ b/sys/net/gnrc/netif/init_devs/auto_init_sam0_eth.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 Mesotic SAS + * + * 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. + */ + +/** + * @ingroup sys_auto_init_gnrc_netif + * @{ + * + * @brief Auto initialize sam0 ethernet driver + * + * @author Dylan Laduranty + */ + +#ifdef MODULE_SAM0_ETH + +#include "net/gnrc/netif/ethernet.h" +#include "sam0_eth_netdev.h" + +static netdev_t sam0eth; +static char stack[THREAD_STACKSIZE_DEFAULT]; +static gnrc_netif_t _netif; + +extern void sam0_eth_setup(netdev_t *netdev); + +void auto_init_sam0_eth(void) +{ + /* setup netdev device */ + sam0_eth_setup(&sam0eth); + /* initialize netdev <-> gnrc adapter state */ + gnrc_netif_ethernet_create(&_netif, stack, THREAD_STACKSIZE_DEFAULT, + GNRC_NETIF_PRIO, "sam0_eth", &sam0eth); +} + +#else +typedef int dont_be_pedantic; +#endif /* MODULE_SAM0_ETH */ +/** @} */ diff --git a/sys/net/gnrc/netif/init_devs/init.c b/sys/net/gnrc/netif/init_devs/init.c index b193d5eadd..beb590cd07 100644 --- a/sys/net/gnrc/netif/init_devs/init.c +++ b/sys/net/gnrc/netif/init_devs/init.c @@ -99,6 +99,11 @@ void gnrc_netif_init_devs(void) auto_init_dose(); } + if (IS_USED(MODULE_SAM0_ETH)) { + extern void auto_init_sam0_eth(void); + auto_init_sam0_eth(); + } + if (IS_USED(MODULE_SLIPDEV)) { extern void auto_init_slipdev(void); auto_init_slipdev();