Microchip® Advanced Software Framework

sam0_spi_ksz8851snl.h File Reference

KSZ8851SNL SAM0 driver for lwIP.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include "lwip/netif.h"
#include "lwip/ip_addr.h"
#include "lwip/err.h"
#include "netif/etharp.h"

Functions

err_t ethernetif_init (struct netif *netif)
 Should be called at the beginning of the program to set up the network interface. More...
 
void ethernetif_input (struct netif *netif)
 This function should be called when a packet is ready to be read from the interface. More...
 

err_t ethernetif_init ( struct netif netif)

Should be called at the beginning of the program to set up the network interface.

It calls the function ksz8851snl_low_level_init() to do the actual setup of the hardware.

Parameters
netifthe lwIP network interface structure for this ethernetif.
Returns
ERR_OK if the loopif is initialized. ERR_MEM if private data couldn't be allocated. any other err_t on error.

References ERR_MEM, ERR_OK, etharp_output(), gs_ksz8851snl_dev, IFNAME0, IFNAME1, ksz8851snl_low_level_init(), ksz8851snl_low_level_output(), netif::linkoutput, LWIP_ASSERT, netif::name, NET_LINK_SPEED, ksz8851snl_device::netif, NETIF_INIT_SNMP, netifINTERFACE_TASK_PRIORITY, netifINTERFACE_TASK_STACK_SIZE, NULL, netif::output, snmp_ifType_ethernet_csmacd, netif::state, and sys_thread_new.

Referenced by ethernet_configure_interface().

void ethernetif_input ( struct netif netif)

This function should be called when a packet is ready to be read from the interface.

It uses the function ksz8851snl_low_level_input() that handles the actual reception of bytes from the network interface. Then the type of the received packet is determined and the appropriate input function is called.

Parameters
netifthe lwIP network interface structure for this ethernetif.

References ERR_OK, ETHTYPE_ARP, ETHTYPE_IP, ETHTYPE_PPPOE, ETHTYPE_PPPOEDISC, htons, netif::input, ksz8851snl_low_level_input(), ksz8851snl_update(), LWIP_DEBUGF, NETIF_DEBUG, NULL, pbuf::payload, and pbuf_free().

Referenced by ethernet_task().