STM32Ethernet
Arduino Ethernet library for STM32 boards
Loading...
Searching...
No Matches
ethernetif.h File Reference

Ethernet interface header file. More...

#include "lwip/err.h"
#include "lwip/netif.h"
Include dependency graph for ethernetif.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

uint8_t ethernetif_is_init (void)
 Check whether the Ethernet hardware has been initialized.
 
err_t ethernetif_init (struct netif *netif)
 LwIP network interface initialization callback.
 
void ethernetif_input (struct netif *netif)
 Read one received frame from the MAC and pass it to LwIP.
 
void ethernetif_set_link (struct netif *netif)
 Poll the PHY and update the LwIP link state of the interface.
 
void ethernetif_update_config (struct netif *netif)
 Apply the PHY auto-negotiation result to the MAC.
 
void ethernetif_notify_conn_changed (struct netif *netif)
 Notify the user that the link status has changed.
 
void ethernetif_set_mac_addr (const uint8_t *mac)
 Set the MAC address used by the driver.
 
void ethernetif_get_mac_addr (uint8_t *mac)
 Copy the MAC address used by the driver.
 

Detailed Description

Ethernet interface header file.

Author
MCD Application Team & Wi6Labs
Version
V1.5.0
Date
20-June-2017
Attention

© Copyright (c) 2017 STMicroelectronics International N.V. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted, provided that the following conditions are met:

  1. Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of other contributors to this software may be used to endorse or promote products derived from this software without specific written permission.
  4. This software, including modifications and/or derivative works of this software, must execute solely and exclusively on microcontroller or microprocessor devices manufactured by or for STMicroelectronics.
  5. Redistribution and use of this software other than as permitted under this license is void and will automatically terminate your rights under this license.

THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ ethernetif_get_mac_addr()

void ethernetif_get_mac_addr ( uint8_t *  mac)

Copy the MAC address used by the driver.

Parameters
macBuffer of at least 6 bytes that receives the address. Nothing is copied if NULL.

◆ ethernetif_init()

err_t ethernetif_init ( struct netif *  netif)

LwIP network interface initialization callback.

Sets the interface name, the output functions and initializes the Ethernet hardware. Pass it to netif_add().

Parameters
netifThe LwIP network interface to initialize.
Returns
ERR_OK.

◆ ethernetif_input()

void ethernetif_input ( struct netif *  netif)

Read one received frame from the MAC and pass it to LwIP.

Does nothing when no frame is available. If netif->input() fails, the frame is dropped.

Parameters
netifThe LwIP network interface.

◆ ethernetif_is_init()

uint8_t ethernetif_is_init ( void  )

Check whether the Ethernet hardware has been initialized.

Returns
1 if initialized, 0 otherwise.

◆ ethernetif_notify_conn_changed()

void ethernetif_notify_conn_changed ( struct netif *  netif)

Notify the user that the link status has changed.

Weak function. The default implementation does nothing, and user code can override it.

Parameters
netifThe LwIP network interface. Not used by the default implementation.

◆ ethernetif_set_link()

void ethernetif_set_link ( struct netif *  netif)

Poll the PHY and update the LwIP link state of the interface.

The link is set down when the PHY reports a link-change interrupt, and up when the PHY reports a linked state. With LWIP_IGMP, IGMP is started on the first link-up.

Parameters
netifThe LwIP network interface.

◆ ethernetif_set_mac_addr()

void ethernetif_set_mac_addr ( const uint8_t *  mac)

Set the MAC address used by the driver.

Call it before ethernetif_init(). The address is copied only while the driver is not initialized.

Parameters
mac6-byte MAC address. Ignored if NULL.

◆ ethernetif_update_config()

void ethernetif_update_config ( struct netif *  netif)

Apply the PHY auto-negotiation result to the MAC.

Restarts the MAC with the negotiated duplex and speed, or stops the MAC when the link is down. If auto-negotiation is disabled or has not completed, the configured duplex and speed are used. Calls ethernetif_notify_conn_changed() at the end. Call it when the link status changes.

Parameters
netifThe LwIP network interface.