1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/lwip/init_devs/auto_init_socket_zep.c
Martine Lenders aa5a18f833
Merge pull request #16974 from yarrick/lwip_netif
pkg/lwip: Add netif_t struct, register all netifs
2022-04-26 23:49:49 +02:00

53 lines
1.5 KiB
C

/*
* Copyright (C) Freie Universität Berlin
*
* 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_lwip_netif
* @{
*
* @file
* @brief Auto initialization for socket_zep network interfaces
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
* @author Erik Ekman <eekman@google.com>
*/
#include "socket_zep.h"
#include "socket_zep_params.h"
#include "net/netdev/ieee802154_submac.h"
#include "lwip_init_devs.h"
#define ENABLE_DEBUG 0
#include "debug.h"
#define NETIF_SOCKET_ZEP_NUMOF ARRAY_SIZE(socket_zep_params)
static lwip_netif_t netif[NETIF_SOCKET_ZEP_NUMOF];
static socket_zep_t socket_zep_devs[NETIF_SOCKET_ZEP_NUMOF];
static netdev_ieee802154_submac_t socket_zep_netdev[SOCKET_ZEP_MAX];
static void auto_init_socket_zep(void)
{
for (unsigned i = 0; i < NETIF_SOCKET_ZEP_NUMOF; i++) {
netdev_register(&socket_zep_netdev[i].dev.netdev, NETDEV_SOCKET_ZEP, i);
netdev_ieee802154_submac_init(&socket_zep_netdev[i]);
socket_zep_hal_setup(&socket_zep_devs[i], &socket_zep_netdev[i].submac.dev);
socket_zep_setup(&socket_zep_devs[i], &socket_zep_params[i]);
if (lwip_add_6lowpan(&netif[i], &socket_zep_netdev[i].dev.netdev) == NULL) {
DEBUG("Could not add socket_zep device\n");
return;
}
}
}
LWIP_INIT_6LOWPAN_NETIF(auto_init_socket_zep);
/** @} */