Ethernet management for the standalone lwIP example.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <string.h>
#include "board.h"
#include "ethernet_sam.h"
#include "gmac.h"
#include "ethernet_phy.h"
#include "timer_mgt_sam.h"
#include "sysclk.h"
#include "lwip/sys.h"
#include "lwip/api.h"
#include "lwip/tcp.h"
#include "lwip/tcpip.h"
#include "lwip/memp.h"
#include "lwip/dhcp.h"
#include "lwip/dns.h"
#include "lwip/stats.h"
#include "lwip/init.h"
#include "lwip/ip_frag.h"
#include "lwip/inet.h"
#include "lwip/tcp_impl.h"
#include "netif/etharp.h"
#include "netif/sam4e_gmac.h"
#include "httpd.h"
Data Structures | |
struct | timers_info |
Timer for calling lwIP tmr functions without system. More... | |
Macros | |
#define | TRACE_DEBUG(...) |
Typedefs | |
typedef struct timers_info | timers_info_t |
Timer for calling lwIP tmr functions without system. More... | |
Functions | |
static void | ethernet_configure_interface (void) |
Set ethernet config. More... | |
void | ethernet_task (void) |
Periodically retrigger timeout process. More... | |
void | init_ethernet (void) |
Create ethernet task, for ethernet management. More... | |
void | status_callback (struct netif *netif) |
Status callback used to print address given by DHCP. More... | |
static void | timers_update (void) |
Process timing functions. More... | |
Variables | |
int8_t | g_c_ipconfig [] |
uint32_t | g_ip_mode |
IP mode: 0 unselected, 1 static, 2 dhcp. More... | |
struct netif | gs_net_if |
Global variable containing MAC Config (hw addr, IP, GW, ...) More... | |
static timers_info_t | gs_timers_table [] |
LwIP tmr functions list. More... | |
#define TRACE_DEBUG | ( | ... | ) |
Referenced by ethernet_configure_interface(), and status_callback().
typedef struct timers_info timers_info_t |
Timer for calling lwIP tmr functions without system.
Set ethernet config.
Default ip addr
Default subnet mask
Default gateway addr
Add data to netif
Make it the default interface
Setup callback function for netif status change
Bring it up
DHCP mode
Static mode
References ip_addr::addr, dhcp_start(), ERR_OK, ETHERNET_CONF_GATEWAY_ADDR0, ETHERNET_CONF_GATEWAY_ADDR1, ETHERNET_CONF_GATEWAY_ADDR2, ETHERNET_CONF_GATEWAY_ADDR3, ETHERNET_CONF_IPADDR0, ETHERNET_CONF_IPADDR1, ETHERNET_CONF_IPADDR2, ETHERNET_CONF_IPADDR3, ETHERNET_CONF_NET_MASK0, ETHERNET_CONF_NET_MASK1, ETHERNET_CONF_NET_MASK2, ETHERNET_CONF_NET_MASK3, ethernet_input(), ethernetif_init(), g_ip_mode, gs_net_if, IP4_ADDR, netif_add(), netif_set_default(), netif_set_status_callback(), netif_set_up(), NULL, status_callback(), and TRACE_DEBUG.
Referenced by init_ethernet().
Periodically retrigger timeout process.
Manage the ethernet packets, if any received process them.
After managing the lwIP timers. trigger corresponding ethernet process.
References ethernetif_input(), gs_net_if, and timers_update().
Referenced by webserver_task().
Create ethernet task, for ethernet management.
Initialize the ethernet interface.
Initialize lwIP
Set hw and IP parameters, initialize MAC too
Bring up the web server
References ethernet_configure_interface(), http_init(), and lwip_init().
Referenced by gfx_task().
Status callback used to print address given by DHCP.
netif | Instance to network interface. |
References g_c_ipconfig, g_ip_mode, inet_ntoa, netif::ip_addr, netif_is_up, and TRACE_DEBUG.
Referenced by ethernet_configure_interface(), and netif_set_status_callback().
Process timing functions.
References gs_timers_table, sys_get_ms(), timers_info::timer, timers_info::timer_func, and timers_info::timer_interval.
Referenced by ethernet_task().
int8_t g_c_ipconfig[] |
Referenced by gfx_task(), and status_callback().
uint32_t g_ip_mode |
IP mode: 0 unselected, 1 static, 2 dhcp.
Referenced by ethernet_configure_interface(), event_handler(), gfx_task(), qtouch_task(), and status_callback().
struct netif gs_net_if |
Global variable containing MAC Config (hw addr, IP, GW, ...)
Referenced by ethernet_configure_interface(), and ethernet_task().
|
static |
LwIP tmr functions list.
Referenced by timers_update().