Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/Ethernet, and anything Ethernet-related in the “HAL” region has never been used in Mbed OS 5. Ethernet is not provided like other core things such as serial. So drivers/Ethernet.h, drivers/Ethernet.cpp and hal/ethernet_api.h, and anything referring to them is obsolete. From 5.0-5.8, Ethernet drivers were written natively as lwIP or Nanostack drivers, and attached via their native APIs. No Mbed OS APIs were involved for driver attachment. Since 5.9, Ethernet drivers are provided by a class derived from `EMAC`, and is attached to lwIP or Nanostack. The above assume Ethernet drivers that send and receive Ethernet frames, in other words it assumes it uses an on-board IP stack. If the interface has an off-board IP stack, then a custom driver needs to derive from `EthInterface` or `WifiInterface` and implement the complete socket API for them. Applications can use various degrees of abstraction by designating particular classes: * NetworkInterface - any interface type * EthInterface/WifiInterface/MeshInterface/CellularInterface – specific interface type, no particular implementation * EthernetInterface – Ethernet using on-board stack, default EMAC * EthernetInterface<EMAC> - Ethernet using on-board stack and particular EMAC ESP8266Interface/BG96CellularModem – Particular network interface The top couple have static “get_default_instance()” methods to locate an appropriate interface for the current target. Or applications can nominate their driver specifically using the lower forms. “EthernetInterface” is a concrete implementation of the abstract “EthInterface”, it means “Use default onboard stack with default EMAC driver, defaults selected by get_default_instance”. That’s only half an abstraction – really portable apps should be saying “EthInterface::get_default_instance” (not caring about onboard or offboard), or “NetworkInterface::get_default_instance” (not caring about Wifi or Ethernet).
- Loading branch information