Skip to content

File espos_eth.h

File List > espos_eth > include > espos_eth.h

Go to the documentation of this file

/*
 * SPDX-FileCopyrightText: 2026 Dirk Wahrheit
 * SPDX-License-Identifier: Apache-2.0
 *
 * espos_eth — wired Ethernet as an espos_net transport.
 *
 * The chip's internal EMAC and an RMII PHY, with DHCP. Nothing above the
 * network seam knows it exists: the transport registers its netif and reports
 * its link into espos_net, and espos_net decides the default route. When the
 * WiFi station is up too, Ethernet carries the route as soon as the cable has
 * an address -- the preference is
 * static (Ethernet over WiFi over Thread, docs/net.md), because a wired link is
 * the one somebody ran a cable for.
 *
 * Pins are not configured here. The chip's EMAC defaults (MDC, MDIO, the RMII
 * data lines and the reference clock) are IDF's ETH_ESP32_EMAC_DEFAULT_CONFIG,
 * which on the ESP32-P4 are exactly the Waveshare ESP32-P4-WIFI6-POE-ETH
 * wiring; the two things that genuinely vary per board -- the PHY address and
 * its reset GPIO -- are Kconfig (menu "espOS Ethernet").
 *
 * The PHY is driven by IDF's generic IEEE 802.3 driver. IDF 6 moved the named
 * PHY drivers (IP101, LAN87xx, ...) out to the component registry; the generic
 * one covers link, speed and duplex from the standard registers, which is all
 * this transport needs, and adds no dependency.
 */
#pragma once

#include <stdbool.h>

#include "esp_err.h"

#ifdef __cplusplus
extern "C" {
#endif

esp_err_t espos_eth_start(void);

esp_err_t espos_eth_stop(void);

bool espos_eth_link_up(void);

#ifdef __cplusplus
}
#endif