LAN8720 Ethernet PHY driver. More...
#include "core/nic.h"Go to the source code of this file.
Functions | |
| error_t | lan8720Init (NetInterface *interface) |
| LAN8720 PHY transceiver initialization. More... | |
| void | lan8720InitHook (NetInterface *interface) |
| LAN8720 custom configuration. More... | |
| void | lan8720Tick (NetInterface *interface) |
| LAN8720 timer handler. More... | |
| void | lan8720EnableIrq (NetInterface *interface) |
| Enable interrupts. More... | |
| void | lan8720DisableIrq (NetInterface *interface) |
| Disable interrupts. More... | |
| void | lan8720EventHandler (NetInterface *interface) |
| LAN8720 event handler. More... | |
| void | lan8720WritePhyReg (NetInterface *interface, uint8_t address, uint16_t data) |
| Write PHY register. More... | |
| uint16_t | lan8720ReadPhyReg (NetInterface *interface, uint8_t address) |
| Read PHY register. More... | |
| void | lan8720DumpPhyReg (NetInterface *interface) |
| Dump PHY registers for debugging purpose. More... | |
Variables | |
| const PhyDriver | lan8720PhyDriver |
| LAN8720 Ethernet PHY driver. More... | |
Detailed Description
LAN8720 Ethernet PHY driver.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.5.4
Definition in file lan8720_driver.h.
Macro Definition Documentation
◆ LAN8720_ANAR
| #define LAN8720_ANAR 0x04 |
Definition at line 49 of file lan8720_driver.h.
◆ LAN8720_ANAR_100BTX_FD
| #define LAN8720_ANAR_100BTX_FD 0x0100 |
Definition at line 100 of file lan8720_driver.h.
◆ LAN8720_ANAR_100BTX_HD
| #define LAN8720_ANAR_100BTX_HD 0x0080 |
Definition at line 101 of file lan8720_driver.h.
◆ LAN8720_ANAR_10BT_FD
| #define LAN8720_ANAR_10BT_FD 0x0040 |
Definition at line 102 of file lan8720_driver.h.
◆ LAN8720_ANAR_10BT_HD
| #define LAN8720_ANAR_10BT_HD 0x0020 |
Definition at line 103 of file lan8720_driver.h.
◆ LAN8720_ANAR_PAUSE
| #define LAN8720_ANAR_PAUSE 0x0C00 |
Definition at line 99 of file lan8720_driver.h.
◆ LAN8720_ANAR_REMOTE_FAULT
| #define LAN8720_ANAR_REMOTE_FAULT 0x2000 |
Definition at line 98 of file lan8720_driver.h.
◆ LAN8720_ANAR_SELECTOR
| #define LAN8720_ANAR_SELECTOR 0x001F |
Definition at line 104 of file lan8720_driver.h.
◆ LAN8720_ANAR_SELECTOR_DEFAULT
| #define LAN8720_ANAR_SELECTOR_DEFAULT 0x0001 |
Definition at line 105 of file lan8720_driver.h.
◆ LAN8720_ANER
| #define LAN8720_ANER 0x06 |
Definition at line 51 of file lan8720_driver.h.
◆ LAN8720_ANER_LP_AN_ABLE
| #define LAN8720_ANER_LP_AN_ABLE 0x0001 |
Definition at line 125 of file lan8720_driver.h.
◆ LAN8720_ANER_LP_NEXT_PAGE_ABLE
| #define LAN8720_ANER_LP_NEXT_PAGE_ABLE 0x0008 |
Definition at line 122 of file lan8720_driver.h.
◆ LAN8720_ANER_NEXT_PAGE_ABLE
| #define LAN8720_ANER_NEXT_PAGE_ABLE 0x0004 |
Definition at line 123 of file lan8720_driver.h.
◆ LAN8720_ANER_PAGE_RECEIVED
| #define LAN8720_ANER_PAGE_RECEIVED 0x0002 |
Definition at line 124 of file lan8720_driver.h.
◆ LAN8720_ANER_PAR_DETECT_FAULT
| #define LAN8720_ANER_PAR_DETECT_FAULT 0x0010 |
Definition at line 121 of file lan8720_driver.h.
◆ LAN8720_ANLPAR
| #define LAN8720_ANLPAR 0x05 |
Definition at line 50 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_100BT4
| #define LAN8720_ANLPAR_100BT4 0x0200 |
Definition at line 112 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_100BTX_FD
| #define LAN8720_ANLPAR_100BTX_FD 0x0100 |
Definition at line 113 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_100BTX_HD
| #define LAN8720_ANLPAR_100BTX_HD 0x0080 |
Definition at line 114 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_10BT_FD
| #define LAN8720_ANLPAR_10BT_FD 0x0040 |
Definition at line 115 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_10BT_HD
| #define LAN8720_ANLPAR_10BT_HD 0x0020 |
Definition at line 116 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_ACK
| #define LAN8720_ANLPAR_ACK 0x4000 |
Definition at line 109 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_NEXT_PAGE
| #define LAN8720_ANLPAR_NEXT_PAGE 0x8000 |
Definition at line 108 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_PAUSE
| #define LAN8720_ANLPAR_PAUSE 0x0400 |
Definition at line 111 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_REMOTE_FAULT
| #define LAN8720_ANLPAR_REMOTE_FAULT 0x2000 |
Definition at line 110 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_SELECTOR
| #define LAN8720_ANLPAR_SELECTOR 0x001F |
Definition at line 117 of file lan8720_driver.h.
◆ LAN8720_ANLPAR_SELECTOR_DEFAULT
| #define LAN8720_ANLPAR_SELECTOR_DEFAULT 0x0001 |
Definition at line 118 of file lan8720_driver.h.
◆ LAN8720_BMCR
| #define LAN8720_BMCR 0x00 |
Definition at line 45 of file lan8720_driver.h.
◆ LAN8720_BMCR_AN_EN
| #define LAN8720_BMCR_AN_EN 0x1000 |
Definition at line 64 of file lan8720_driver.h.
◆ LAN8720_BMCR_DUPLEX_MODE
| #define LAN8720_BMCR_DUPLEX_MODE 0x0100 |
Definition at line 68 of file lan8720_driver.h.
◆ LAN8720_BMCR_ISOLATE
| #define LAN8720_BMCR_ISOLATE 0x0400 |
Definition at line 66 of file lan8720_driver.h.
◆ LAN8720_BMCR_LOOPBACK
| #define LAN8720_BMCR_LOOPBACK 0x4000 |
Definition at line 62 of file lan8720_driver.h.
◆ LAN8720_BMCR_POWER_DOWN
| #define LAN8720_BMCR_POWER_DOWN 0x0800 |
Definition at line 65 of file lan8720_driver.h.
◆ LAN8720_BMCR_RESET
| #define LAN8720_BMCR_RESET 0x8000 |
Definition at line 61 of file lan8720_driver.h.
◆ LAN8720_BMCR_RESTART_AN
| #define LAN8720_BMCR_RESTART_AN 0x0200 |
Definition at line 67 of file lan8720_driver.h.
◆ LAN8720_BMCR_SPEED_SEL
| #define LAN8720_BMCR_SPEED_SEL 0x2000 |
Definition at line 63 of file lan8720_driver.h.
◆ LAN8720_BMSR
| #define LAN8720_BMSR 0x01 |
Definition at line 46 of file lan8720_driver.h.
◆ LAN8720_BMSR_100BT2_FD
| #define LAN8720_BMSR_100BT2_FD 0x0400 |
Definition at line 76 of file lan8720_driver.h.
◆ LAN8720_BMSR_100BT2_HD
| #define LAN8720_BMSR_100BT2_HD 0x0200 |
Definition at line 77 of file lan8720_driver.h.
◆ LAN8720_BMSR_100BT4
| #define LAN8720_BMSR_100BT4 0x8000 |
Definition at line 71 of file lan8720_driver.h.
◆ LAN8720_BMSR_100BTX_FD
| #define LAN8720_BMSR_100BTX_FD 0x4000 |
Definition at line 72 of file lan8720_driver.h.
◆ LAN8720_BMSR_100BTX_HD
| #define LAN8720_BMSR_100BTX_HD 0x2000 |
Definition at line 73 of file lan8720_driver.h.
◆ LAN8720_BMSR_10BT_FD
| #define LAN8720_BMSR_10BT_FD 0x1000 |
Definition at line 74 of file lan8720_driver.h.
◆ LAN8720_BMSR_10BT_HD
| #define LAN8720_BMSR_10BT_HD 0x0800 |
Definition at line 75 of file lan8720_driver.h.
◆ LAN8720_BMSR_AN_CAPABLE
| #define LAN8720_BMSR_AN_CAPABLE 0x0008 |
Definition at line 81 of file lan8720_driver.h.
◆ LAN8720_BMSR_AN_COMPLETE
| #define LAN8720_BMSR_AN_COMPLETE 0x0020 |
Definition at line 79 of file lan8720_driver.h.
◆ LAN8720_BMSR_EXTENDED_CAPABLE
| #define LAN8720_BMSR_EXTENDED_CAPABLE 0x0001 |
Definition at line 84 of file lan8720_driver.h.
◆ LAN8720_BMSR_EXTENDED_STATUS
| #define LAN8720_BMSR_EXTENDED_STATUS 0x0100 |
Definition at line 78 of file lan8720_driver.h.
◆ LAN8720_BMSR_JABBER_DETECT
| #define LAN8720_BMSR_JABBER_DETECT 0x0002 |
Definition at line 83 of file lan8720_driver.h.
◆ LAN8720_BMSR_LINK_STATUS
| #define LAN8720_BMSR_LINK_STATUS 0x0004 |
Definition at line 82 of file lan8720_driver.h.
◆ LAN8720_BMSR_REMOTE_FAULT
| #define LAN8720_BMSR_REMOTE_FAULT 0x0010 |
Definition at line 80 of file lan8720_driver.h.
◆ LAN8720_IMR
| #define LAN8720_IMR 0x1E |
Definition at line 57 of file lan8720_driver.h.
◆ LAN8720_IMR_AN_COMPLETE
| #define LAN8720_IMR_AN_COMPLETE 0x0040 |
Definition at line 157 of file lan8720_driver.h.
◆ LAN8720_IMR_AN_LP_ACK
| #define LAN8720_IMR_AN_LP_ACK 0x0008 |
Definition at line 160 of file lan8720_driver.h.
◆ LAN8720_IMR_AN_PAGE_RECEIVED
| #define LAN8720_IMR_AN_PAGE_RECEIVED 0x0002 |
Definition at line 162 of file lan8720_driver.h.
◆ LAN8720_IMR_ENERGYON
| #define LAN8720_IMR_ENERGYON 0x0080 |
Definition at line 156 of file lan8720_driver.h.
◆ LAN8720_IMR_LINK_DOWN
| #define LAN8720_IMR_LINK_DOWN 0x0010 |
Definition at line 159 of file lan8720_driver.h.
◆ LAN8720_IMR_PAR_DETECT_FAULT
| #define LAN8720_IMR_PAR_DETECT_FAULT 0x0004 |
Definition at line 161 of file lan8720_driver.h.
◆ LAN8720_IMR_REMOTE_FAULT
| #define LAN8720_IMR_REMOTE_FAULT 0x0020 |
Definition at line 158 of file lan8720_driver.h.
◆ LAN8720_ISR
| #define LAN8720_ISR 0x1D |
Definition at line 56 of file lan8720_driver.h.
◆ LAN8720_ISR_AN_COMPLETE
| #define LAN8720_ISR_AN_COMPLETE 0x0040 |
Definition at line 148 of file lan8720_driver.h.
◆ LAN8720_ISR_AN_LP_ACK
| #define LAN8720_ISR_AN_LP_ACK 0x0008 |
Definition at line 151 of file lan8720_driver.h.
◆ LAN8720_ISR_AN_PAGE_RECEIVED
| #define LAN8720_ISR_AN_PAGE_RECEIVED 0x0002 |
Definition at line 153 of file lan8720_driver.h.
◆ LAN8720_ISR_ENERGYON
| #define LAN8720_ISR_ENERGYON 0x0080 |
Definition at line 147 of file lan8720_driver.h.
◆ LAN8720_ISR_LINK_DOWN
| #define LAN8720_ISR_LINK_DOWN 0x0010 |
Definition at line 150 of file lan8720_driver.h.
◆ LAN8720_ISR_PAR_DETECT_FAULT
| #define LAN8720_ISR_PAR_DETECT_FAULT 0x0004 |
Definition at line 152 of file lan8720_driver.h.
◆ LAN8720_ISR_REMOTE_FAULT
| #define LAN8720_ISR_REMOTE_FAULT 0x0020 |
Definition at line 149 of file lan8720_driver.h.
◆ LAN8720_MCSR
| #define LAN8720_MCSR 0x11 |
Definition at line 52 of file lan8720_driver.h.
◆ LAN8720_MCSR_ALTINT
| #define LAN8720_MCSR_ALTINT 0x0040 |
Definition at line 130 of file lan8720_driver.h.
◆ LAN8720_MCSR_EDPWRDOWN
| #define LAN8720_MCSR_EDPWRDOWN 0x2000 |
Definition at line 128 of file lan8720_driver.h.
◆ LAN8720_MCSR_ENERGYON
| #define LAN8720_MCSR_ENERGYON 0x0002 |
Definition at line 131 of file lan8720_driver.h.
◆ LAN8720_MCSR_FARLOOPBACK
| #define LAN8720_MCSR_FARLOOPBACK 0x0200 |
Definition at line 129 of file lan8720_driver.h.
◆ LAN8720_PHY_ADDR
| #define LAN8720_PHY_ADDR 0 |
Definition at line 39 of file lan8720_driver.h.
◆ LAN8720_PHYID1
| #define LAN8720_PHYID1 0x02 |
Definition at line 47 of file lan8720_driver.h.
◆ LAN8720_PHYID1_PHY_ID_MSB
| #define LAN8720_PHYID1_PHY_ID_MSB 0xFFFF |
Definition at line 87 of file lan8720_driver.h.
◆ LAN8720_PHYID1_PHY_ID_MSB_DEFAULT
| #define LAN8720_PHYID1_PHY_ID_MSB_DEFAULT 0x0007 |
Definition at line 88 of file lan8720_driver.h.
◆ LAN8720_PHYID2
| #define LAN8720_PHYID2 0x03 |
Definition at line 48 of file lan8720_driver.h.
◆ LAN8720_PHYID2_MODEL_NUM
| #define LAN8720_PHYID2_MODEL_NUM 0x03F0 |
Definition at line 93 of file lan8720_driver.h.
◆ LAN8720_PHYID2_MODEL_NUM_DEFAULT
| #define LAN8720_PHYID2_MODEL_NUM_DEFAULT 0x00F0 |
Definition at line 94 of file lan8720_driver.h.
◆ LAN8720_PHYID2_PHY_ID_LSB
| #define LAN8720_PHYID2_PHY_ID_LSB 0xFC00 |
Definition at line 91 of file lan8720_driver.h.
◆ LAN8720_PHYID2_PHY_ID_LSB_DEFAULT
| #define LAN8720_PHYID2_PHY_ID_LSB_DEFAULT 0xC000 |
Definition at line 92 of file lan8720_driver.h.
◆ LAN8720_PHYID2_REVISION_NUM
| #define LAN8720_PHYID2_REVISION_NUM 0x000F |
Definition at line 95 of file lan8720_driver.h.
◆ LAN8720_PSCSR
| #define LAN8720_PSCSR 0x1F |
Definition at line 58 of file lan8720_driver.h.
◆ LAN8720_PSCSR_AUTODONE
| #define LAN8720_PSCSR_AUTODONE 0x1000 |
Definition at line 165 of file lan8720_driver.h.
◆ LAN8720_PSCSR_HCDSPEED
| #define LAN8720_PSCSR_HCDSPEED 0x001C |
Definition at line 166 of file lan8720_driver.h.
◆ LAN8720_PSCSR_HCDSPEED_100BTX_FD
| #define LAN8720_PSCSR_HCDSPEED_100BTX_FD 0x0018 |
Definition at line 170 of file lan8720_driver.h.
◆ LAN8720_PSCSR_HCDSPEED_100BTX_HD
| #define LAN8720_PSCSR_HCDSPEED_100BTX_HD 0x0008 |
Definition at line 168 of file lan8720_driver.h.
◆ LAN8720_PSCSR_HCDSPEED_10BT_FD
| #define LAN8720_PSCSR_HCDSPEED_10BT_FD 0x0014 |
Definition at line 169 of file lan8720_driver.h.
◆ LAN8720_PSCSR_HCDSPEED_10BT_HD
| #define LAN8720_PSCSR_HCDSPEED_10BT_HD 0x0004 |
Definition at line 167 of file lan8720_driver.h.
◆ LAN8720_SCSIR
| #define LAN8720_SCSIR 0x1B |
Definition at line 55 of file lan8720_driver.h.
◆ LAN8720_SCSIR_AMDIXCTRL
| #define LAN8720_SCSIR_AMDIXCTRL 0x8000 |
Definition at line 141 of file lan8720_driver.h.
◆ LAN8720_SCSIR_CH_SELECT
| #define LAN8720_SCSIR_CH_SELECT 0x2000 |
Definition at line 142 of file lan8720_driver.h.
◆ LAN8720_SCSIR_SQEOFF
| #define LAN8720_SCSIR_SQEOFF 0x0800 |
Definition at line 143 of file lan8720_driver.h.
◆ LAN8720_SCSIR_XPOL
| #define LAN8720_SCSIR_XPOL 0x0010 |
Definition at line 144 of file lan8720_driver.h.
◆ LAN8720_SECR
| #define LAN8720_SECR 0x1A |
Definition at line 54 of file lan8720_driver.h.
◆ LAN8720_SECR_SYM_ERR_CNT
| #define LAN8720_SECR_SYM_ERR_CNT 0xFFFF |
Definition at line 138 of file lan8720_driver.h.
◆ LAN8720_SMR
| #define LAN8720_SMR 0x12 |
Definition at line 53 of file lan8720_driver.h.
◆ LAN8720_SMR_MODE
| #define LAN8720_SMR_MODE 0x00E0 |
Definition at line 134 of file lan8720_driver.h.
◆ LAN8720_SMR_PHYAD
| #define LAN8720_SMR_PHYAD 0x001F |
Definition at line 135 of file lan8720_driver.h.
Function Documentation
◆ lan8720DisableIrq()
| void lan8720DisableIrq | ( | NetInterface * | interface | ) |
Disable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 188 of file lan8720_driver.c.
◆ lan8720DumpPhyReg()
| void lan8720DumpPhyReg | ( | NetInterface * | interface | ) |
Dump PHY registers for debugging purpose.
- Parameters
-
[in] interface Underlying network interface
Definition at line 333 of file lan8720_driver.c.
◆ lan8720EnableIrq()
| void lan8720EnableIrq | ( | NetInterface * | interface | ) |
Enable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 173 of file lan8720_driver.c.
◆ lan8720EventHandler()
| void lan8720EventHandler | ( | NetInterface * | interface | ) |
LAN8720 event handler.
- Parameters
-
[in] interface Underlying network interface
Definition at line 203 of file lan8720_driver.c.
◆ lan8720Init()
| error_t lan8720Init | ( | NetInterface * | interface | ) |
LAN8720 PHY transceiver initialization.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 60 of file lan8720_driver.c.
◆ lan8720InitHook()
| void lan8720InitHook | ( | NetInterface * | interface | ) |
LAN8720 custom configuration.
- Parameters
-
[in] interface Underlying network interface
Definition at line 125 of file lan8720_driver.c.
◆ lan8720ReadPhyReg()
| uint16_t lan8720ReadPhyReg | ( | NetInterface * | interface, |
| uint8_t | address | ||
| ) |
Read PHY register.
- Parameters
-
[in] interface Underlying network interface [in] address PHY register address
- Returns
- Register value
Definition at line 307 of file lan8720_driver.c.
◆ lan8720Tick()
| void lan8720Tick | ( | NetInterface * | interface | ) |
LAN8720 timer handler.
- Parameters
-
[in] interface Underlying network interface
Definition at line 135 of file lan8720_driver.c.
◆ lan8720WritePhyReg()
| void lan8720WritePhyReg | ( | NetInterface * | interface, |
| uint8_t | address, | ||
| uint16_t | data | ||
| ) |
Write PHY register.
- Parameters
-
[in] interface Underlying network interface [in] address PHY register address [in] data Register value
Definition at line 283 of file lan8720_driver.c.
Variable Documentation
◆ lan8720PhyDriver
|
extern |
LAN8720 Ethernet PHY driver.
Definition at line 44 of file lan8720_driver.c.
