lan8740_driver.h File Reference

LAN8740 Ethernet PHY driver. More...

#include "core/nic.h"

Go to the source code of this file.

Macros

#define LAN8740_PHY_ADDR   0
 
#define LAN8740_BMCR   0x00
 
#define LAN8740_BMSR   0x01
 
#define LAN8740_PHYID1   0x02
 
#define LAN8740_PHYID2   0x03
 
#define LAN8740_ANAR   0x04
 
#define LAN8740_ANLPAR   0x05
 
#define LAN8740_ANER   0x06
 
#define LAN8740_ANNPTR   0x07
 
#define LAN8740_ANNPRR   0x08
 
#define LAN8740_MMDACR   0x0D
 
#define LAN8740_MMDAADR   0x0E
 
#define LAN8740_ENCTECR   0x10
 
#define LAN8740_MCSR   0x11
 
#define LAN8740_SMR   0x12
 
#define LAN8740_TDRPDCR   0x18
 
#define LAN8740_TDRCSR   0x19
 
#define LAN8740_SECR   0x1A
 
#define LAN8740_SCSIR   0x1B
 
#define LAN8740_CLR   0x1C
 
#define LAN8740_ISR   0x1D
 
#define LAN8740_IMR   0x1E
 
#define LAN8740_PSCSR   0x1F
 
#define LAN8740_PCS_CTRL1   0x03, 0x0000
 
#define LAN8740_PCS_STAT1   0x03, 0x0001
 
#define LAN8740_PCS_MMD_DEV_PRES1   0x03, 0x0005
 
#define LAN8740_PCS_MMD_DEV_PRES2   0x03, 0x0006
 
#define LAN8740_EEE_CAPABILITY   0x03, 0x0014
 
#define LAN8740_EEE_WAKE_ERROR   0x03, 0x0016
 
#define LAN8740_WUCSR   0x03, 0x8010
 
#define LAN8740_WUF_CFGA   0x03, 0x8011
 
#define LAN8740_WUF_CFGB   0x03, 0x8012
 
#define LAN8740_WUF_MASK   0x03, 0x8021
 
#define LAN8740_RX_ADDRA   0x03, 0x8061
 
#define LAN8740_RX_ADDRB   0x03, 0x8062
 
#define LAN8740_RX_ADDRC   0x03, 0x8063
 
#define LAN8740_MCFGR   0x03, 0x8064
 
#define LAN8740_AN_MMD_DEV_PRES1   0x07, 0x0005
 
#define LAN8740_AN_MMD_DEV_PRES2   0x07, 0x0006
 
#define LAN8740_EEE_ADV   0x07, 0x003C
 
#define LAN8740_EEE_LP_ADV   0x07, 0x003D
 
#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_ID1   0x1E, 0x0002
 
#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_ID2   0x1E, 0x0003
 
#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_PRES1   0x1E, 0x0005
 
#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_PRES2   0x1E, 0x0006
 
#define LAN8740_VENDOR_SPECIFIC_MMD1_STAT   0x1E, 0x0008
 
#define LAN8740_TDR_MATCH_THRESHOLD   0x1E, 0x000B
 
#define LAN8740_TDR_SHORT_OPEN_THRESHOLD   0x1E, 0x000C
 
#define LAN8740_VENDOR_SPECIFIC_MMD1_PKG_ID1   0x1E, 0x000E
 
#define LAN8740_VENDOR_SPECIFIC_MMD1_PKG_ID2   0x1E, 0x000F
 
#define LAN8740_BMCR_RESET   0x8000
 
#define LAN8740_BMCR_LOOPBACK   0x4000
 
#define LAN8740_BMCR_SPEED_SEL   0x2000
 
#define LAN8740_BMCR_AN_EN   0x1000
 
#define LAN8740_BMCR_POWER_DOWN   0x0800
 
#define LAN8740_BMCR_ISOLATE   0x0400
 
#define LAN8740_BMCR_RESTART_AN   0x0200
 
#define LAN8740_BMCR_DUPLEX_MODE   0x0100
 
#define LAN8740_BMCR_COL_TEST   0x0080
 
#define LAN8740_BMSR_100BT4   0x8000
 
#define LAN8740_BMSR_100BTX_FD   0x4000
 
#define LAN8740_BMSR_100BTX_HD   0x2000
 
#define LAN8740_BMSR_10BT_FD   0x1000
 
#define LAN8740_BMSR_10BT_HD   0x0800
 
#define LAN8740_BMSR_100BT2_FD   0x0400
 
#define LAN8740_BMSR_100BT2_HD   0x0200
 
#define LAN8740_BMSR_EXTENDED_STATUS   0x0100
 
#define LAN8740_BMSR_AN_COMPLETE   0x0020
 
#define LAN8740_BMSR_REMOTE_FAULT   0x0010
 
#define LAN8740_BMSR_AN_CAPABLE   0x0008
 
#define LAN8740_BMSR_LINK_STATUS   0x0004
 
#define LAN8740_BMSR_JABBER_DETECT   0x0002
 
#define LAN8740_BMSR_EXTENDED_CAPABLE   0x0001
 
#define LAN8740_PHYID1_PHY_ID_MSB   0xFFFF
 
#define LAN8740_PHYID1_PHY_ID_MSB_DEFAULT   0x0007
 
#define LAN8740_PHYID2_PHY_ID_LSB   0xFC00
 
#define LAN8740_PHYID2_PHY_ID_LSB_DEFAULT   0xC000
 
#define LAN8740_PHYID2_MODEL_NUM   0x03F0
 
#define LAN8740_PHYID2_MODEL_NUM_DEFAULT   0x0110
 
#define LAN8740_PHYID2_REVISION_NUM   0x000F
 
#define LAN8740_ANAR_NEXT_PAGE   0x8000
 
#define LAN8740_ANAR_REMOTE_FAULT   0x2000
 
#define LAN8740_ANAR_PAUSE   0x0C00
 
#define LAN8740_ANAR_100BTX_FD   0x0100
 
#define LAN8740_ANAR_100BTX_HD   0x0080
 
#define LAN8740_ANAR_10BT_FD   0x0040
 
#define LAN8740_ANAR_10BT_HD   0x0020
 
#define LAN8740_ANAR_SELECTOR   0x001F
 
#define LAN8740_ANAR_SELECTOR_DEFAULT   0x0001
 
#define LAN8740_ANLPAR_NEXT_PAGE   0x8000
 
#define LAN8740_ANLPAR_ACK   0x4000
 
#define LAN8740_ANLPAR_REMOTE_FAULT   0x2000
 
#define LAN8740_ANLPAR_PAUSE   0x0400
 
#define LAN8740_ANLPAR_100BT4   0x0200
 
#define LAN8740_ANLPAR_100BTX_FD   0x0100
 
#define LAN8740_ANLPAR_100BTX_HD   0x0080
 
#define LAN8740_ANLPAR_10BT_FD   0x0040
 
#define LAN8740_ANLPAR_10BT_HD   0x0020
 
#define LAN8740_ANLPAR_SELECTOR   0x001F
 
#define LAN8740_ANLPAR_SELECTOR_DEFAULT   0x0001
 
#define LAN8740_ANER_RECEIVE_NP_LOC_ABLE   0x0040
 
#define LAN8740_ANER_RECEIVE_NP_STOR_LOC   0x0020
 
#define LAN8740_ANER_PAR_DETECT_FAULT   0x0010
 
#define LAN8740_ANER_LP_NEXT_PAGE_ABLE   0x0008
 
#define LAN8740_ANER_NEXT_PAGE_ABLE   0x0004
 
#define LAN8740_ANER_PAGE_RECEIVED   0x0002
 
#define LAN8740_ANER_LP_AN_ABLE   0x0001
 
#define LAN8740_ANNPTR_NEXT_PAGE   0x8000
 
#define LAN8740_ANNPTR_MSG_PAGE   0x2000
 
#define LAN8740_ANNPTR_ACK2   0x1000
 
#define LAN8740_ANNPTR_TOGGLE   0x0800
 
#define LAN8740_ANNPTR_MESSAGE   0x07FF
 
#define LAN8740_ANNPRR_NEXT_PAGE   0x8000
 
#define LAN8740_ANNPRR_ACK   0x4000
 
#define LAN8740_ANNPRR_MSG_PAGE   0x2000
 
#define LAN8740_ANNPRR_ACK2   0x1000
 
#define LAN8740_ANNPRR_TOGGLE   0x0800
 
#define LAN8740_ANNPRR_MESSAGE   0x07FF
 
#define LAN8740_MMDACR_FUNC   0xC000
 
#define LAN8740_MMDACR_FUNC_ADDR   0x0000
 
#define LAN8740_MMDACR_FUNC_DATA_NO_POST_INC   0x4000
 
#define LAN8740_MMDACR_DEVAD   0x001F
 
#define LAN8740_ENCTECR_EDPD_TX_NLP_EN   0x8000
 
#define LAN8740_ENCTECR_EDPD_TX_NLP_ITS   0x6000
 
#define LAN8740_ENCTECR_RX_NLP_WAKE_EN   0x1000
 
#define LAN8740_ENCTECR_RX_NLP_MIDS   0x0C00
 
#define LAN8740_ENCTECR_PHY_EEE_EN   0x0004
 
#define LAN8740_ENCTECR_EDPD_EXT_CROSSOVER   0x0002
 
#define LAN8740_ENCTECR_EXT_CROSSOVER_TIME   0x0001
 
#define LAN8740_MCSR_EDPWRDOWN   0x2000
 
#define LAN8740_MCSR_FARLOOPBACK   0x0200
 
#define LAN8740_MCSR_ALTINT   0x0040
 
#define LAN8740_MCSR_ENERGYON   0x0002
 
#define LAN8740_SMR_MIIMODE   0x4000
 
#define LAN8740_SMR_MODE   0x00E0
 
#define LAN8740_SMR_PHYAD   0x001F
 
#define LAN8740_TDRPDCR_DELAY_IN   0x8000
 
#define LAN8740_TDRPDCR_LINE_BREAK_COUNT   0x7000
 
#define LAN8740_TDRPDCR_PATTERN_HIGH   0x0FC0
 
#define LAN8740_TDRPDCR_PATTERN_LOW   0x003F
 
#define LAN8740_TDRCSR_TDR_EN   0x8000
 
#define LAN8740_TDRCSR_AD_FILTER_EN   0x4000
 
#define LAN8740_TDRCSR_CH_CABLE_TYPE   0x0600
 
#define LAN8740_TDRCSR_CH_STATUS   0x0100
 
#define LAN8740_TDRCSR_CH_LENGTH   0x00FF
 
#define LAN8740_SECR_SYM_ERR_CNT   0xFFFF
 
#define LAN8740_SCSIR_AMDIXCTRL   0x8000
 
#define LAN8740_SCSIR_CH_SELECT   0x2000
 
#define LAN8740_SCSIR_SQEOFF   0x0800
 
#define LAN8740_SCSIR_XPOL   0x0010
 
#define LAN8740_CLR_CBLN   0xF000
 
#define LAN8740_ISR_WOL   0x0100
 
#define LAN8740_ISR_ENERGYON   0x0080
 
#define LAN8740_ISR_AN_COMPLETE   0x0040
 
#define LAN8740_ISR_REMOTE_FAULT   0x0020
 
#define LAN8740_ISR_LINK_DOWN   0x0010
 
#define LAN8740_ISR_AN_LP_ACK   0x0008
 
#define LAN8740_ISR_PAR_DETECT_FAULT   0x0004
 
#define LAN8740_ISR_AN_PAGE_RECEIVED   0x0002
 
#define LAN8740_IMR_WOL   0x0100
 
#define LAN8740_IMR_ENERGYON   0x0080
 
#define LAN8740_IMR_AN_COMPLETE   0x0040
 
#define LAN8740_IMR_REMOTE_FAULT   0x0020
 
#define LAN8740_IMR_LINK_DOWN   0x0010
 
#define LAN8740_IMR_AN_LP_ACK   0x0008
 
#define LAN8740_IMR_PAR_DETECT_FAULT   0x0004
 
#define LAN8740_IMR_AN_PAGE_RECEIVED   0x0002
 
#define LAN8740_PSCSR_AUTODONE   0x1000
 
#define LAN8740_PSCSR_4B5B_EN   0x0040
 
#define LAN8740_PSCSR_HCDSPEED   0x001C
 
#define LAN8740_PSCSR_HCDSPEED_10BT_HD   0x0004
 
#define LAN8740_PSCSR_HCDSPEED_100BTX_HD   0x0008
 
#define LAN8740_PSCSR_HCDSPEED_10BT_FD   0x0014
 
#define LAN8740_PSCSR_HCDSPEED_100BTX_FD   0x0018
 

Functions

error_t lan8740Init (NetInterface *interface)
 LAN8740 PHY transceiver initialization. More...
 
void lan8740InitHook (NetInterface *interface)
 LAN8740 custom configuration. More...
 
void lan8740Tick (NetInterface *interface)
 LAN8740 timer handler. More...
 
void lan8740EnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void lan8740DisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
void lan8740EventHandler (NetInterface *interface)
 LAN8740 event handler. More...
 
void lan8740WritePhyReg (NetInterface *interface, uint8_t address, uint16_t data)
 Write PHY register. More...
 
uint16_t lan8740ReadPhyReg (NetInterface *interface, uint8_t address)
 Read PHY register. More...
 
void lan8740DumpPhyReg (NetInterface *interface)
 Dump PHY registers for debugging purpose. More...
 
void lan8740WriteMmdReg (NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
 Write MMD register. More...
 
uint16_t lan8740ReadMmdReg (NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
 Read MMD register. More...
 

Variables

const PhyDriver lan8740PhyDriver
 LAN8740 Ethernet PHY driver. More...
 

Detailed Description

LAN8740 Ethernet PHY driver.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file lan8740_driver.h.

Macro Definition Documentation

◆ LAN8740_AN_MMD_DEV_PRES1

#define LAN8740_AN_MMD_DEV_PRES1   0x07, 0x0005

Definition at line 83 of file lan8740_driver.h.

◆ LAN8740_AN_MMD_DEV_PRES2

#define LAN8740_AN_MMD_DEV_PRES2   0x07, 0x0006

Definition at line 84 of file lan8740_driver.h.

◆ LAN8740_ANAR

#define LAN8740_ANAR   0x04

Definition at line 49 of file lan8740_driver.h.

◆ LAN8740_ANAR_100BTX_FD

#define LAN8740_ANAR_100BTX_FD   0x0100

Definition at line 139 of file lan8740_driver.h.

◆ LAN8740_ANAR_100BTX_HD

#define LAN8740_ANAR_100BTX_HD   0x0080

Definition at line 140 of file lan8740_driver.h.

◆ LAN8740_ANAR_10BT_FD

#define LAN8740_ANAR_10BT_FD   0x0040

Definition at line 141 of file lan8740_driver.h.

◆ LAN8740_ANAR_10BT_HD

#define LAN8740_ANAR_10BT_HD   0x0020

Definition at line 142 of file lan8740_driver.h.

◆ LAN8740_ANAR_NEXT_PAGE

#define LAN8740_ANAR_NEXT_PAGE   0x8000

Definition at line 136 of file lan8740_driver.h.

◆ LAN8740_ANAR_PAUSE

#define LAN8740_ANAR_PAUSE   0x0C00

Definition at line 138 of file lan8740_driver.h.

◆ LAN8740_ANAR_REMOTE_FAULT

#define LAN8740_ANAR_REMOTE_FAULT   0x2000

Definition at line 137 of file lan8740_driver.h.

◆ LAN8740_ANAR_SELECTOR

#define LAN8740_ANAR_SELECTOR   0x001F

Definition at line 143 of file lan8740_driver.h.

◆ LAN8740_ANAR_SELECTOR_DEFAULT

#define LAN8740_ANAR_SELECTOR_DEFAULT   0x0001

Definition at line 144 of file lan8740_driver.h.

◆ LAN8740_ANER

#define LAN8740_ANER   0x06

Definition at line 51 of file lan8740_driver.h.

◆ LAN8740_ANER_LP_AN_ABLE

#define LAN8740_ANER_LP_AN_ABLE   0x0001

Definition at line 166 of file lan8740_driver.h.

◆ LAN8740_ANER_LP_NEXT_PAGE_ABLE

#define LAN8740_ANER_LP_NEXT_PAGE_ABLE   0x0008

Definition at line 163 of file lan8740_driver.h.

◆ LAN8740_ANER_NEXT_PAGE_ABLE

#define LAN8740_ANER_NEXT_PAGE_ABLE   0x0004

Definition at line 164 of file lan8740_driver.h.

◆ LAN8740_ANER_PAGE_RECEIVED

#define LAN8740_ANER_PAGE_RECEIVED   0x0002

Definition at line 165 of file lan8740_driver.h.

◆ LAN8740_ANER_PAR_DETECT_FAULT

#define LAN8740_ANER_PAR_DETECT_FAULT   0x0010

Definition at line 162 of file lan8740_driver.h.

◆ LAN8740_ANER_RECEIVE_NP_LOC_ABLE

#define LAN8740_ANER_RECEIVE_NP_LOC_ABLE   0x0040

Definition at line 160 of file lan8740_driver.h.

◆ LAN8740_ANER_RECEIVE_NP_STOR_LOC

#define LAN8740_ANER_RECEIVE_NP_STOR_LOC   0x0020

Definition at line 161 of file lan8740_driver.h.

◆ LAN8740_ANLPAR

#define LAN8740_ANLPAR   0x05

Definition at line 50 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_100BT4

#define LAN8740_ANLPAR_100BT4   0x0200

Definition at line 151 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_100BTX_FD

#define LAN8740_ANLPAR_100BTX_FD   0x0100

Definition at line 152 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_100BTX_HD

#define LAN8740_ANLPAR_100BTX_HD   0x0080

Definition at line 153 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_10BT_FD

#define LAN8740_ANLPAR_10BT_FD   0x0040

Definition at line 154 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_10BT_HD

#define LAN8740_ANLPAR_10BT_HD   0x0020

Definition at line 155 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_ACK

#define LAN8740_ANLPAR_ACK   0x4000

Definition at line 148 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_NEXT_PAGE

#define LAN8740_ANLPAR_NEXT_PAGE   0x8000

Definition at line 147 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_PAUSE

#define LAN8740_ANLPAR_PAUSE   0x0400

Definition at line 150 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_REMOTE_FAULT

#define LAN8740_ANLPAR_REMOTE_FAULT   0x2000

Definition at line 149 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_SELECTOR

#define LAN8740_ANLPAR_SELECTOR   0x001F

Definition at line 156 of file lan8740_driver.h.

◆ LAN8740_ANLPAR_SELECTOR_DEFAULT

#define LAN8740_ANLPAR_SELECTOR_DEFAULT   0x0001

Definition at line 157 of file lan8740_driver.h.

◆ LAN8740_ANNPRR

#define LAN8740_ANNPRR   0x08

Definition at line 53 of file lan8740_driver.h.

◆ LAN8740_ANNPRR_ACK

#define LAN8740_ANNPRR_ACK   0x4000

Definition at line 177 of file lan8740_driver.h.

◆ LAN8740_ANNPRR_ACK2

#define LAN8740_ANNPRR_ACK2   0x1000

Definition at line 179 of file lan8740_driver.h.

◆ LAN8740_ANNPRR_MESSAGE

#define LAN8740_ANNPRR_MESSAGE   0x07FF

Definition at line 181 of file lan8740_driver.h.

◆ LAN8740_ANNPRR_MSG_PAGE

#define LAN8740_ANNPRR_MSG_PAGE   0x2000

Definition at line 178 of file lan8740_driver.h.

◆ LAN8740_ANNPRR_NEXT_PAGE

#define LAN8740_ANNPRR_NEXT_PAGE   0x8000

Definition at line 176 of file lan8740_driver.h.

◆ LAN8740_ANNPRR_TOGGLE

#define LAN8740_ANNPRR_TOGGLE   0x0800

Definition at line 180 of file lan8740_driver.h.

◆ LAN8740_ANNPTR

#define LAN8740_ANNPTR   0x07

Definition at line 52 of file lan8740_driver.h.

◆ LAN8740_ANNPTR_ACK2

#define LAN8740_ANNPTR_ACK2   0x1000

Definition at line 171 of file lan8740_driver.h.

◆ LAN8740_ANNPTR_MESSAGE

#define LAN8740_ANNPTR_MESSAGE   0x07FF

Definition at line 173 of file lan8740_driver.h.

◆ LAN8740_ANNPTR_MSG_PAGE

#define LAN8740_ANNPTR_MSG_PAGE   0x2000

Definition at line 170 of file lan8740_driver.h.

◆ LAN8740_ANNPTR_NEXT_PAGE

#define LAN8740_ANNPTR_NEXT_PAGE   0x8000

Definition at line 169 of file lan8740_driver.h.

◆ LAN8740_ANNPTR_TOGGLE

#define LAN8740_ANNPTR_TOGGLE   0x0800

Definition at line 172 of file lan8740_driver.h.

◆ LAN8740_BMCR

#define LAN8740_BMCR   0x00

Definition at line 45 of file lan8740_driver.h.

◆ LAN8740_BMCR_AN_EN

#define LAN8740_BMCR_AN_EN   0x1000

Definition at line 101 of file lan8740_driver.h.

◆ LAN8740_BMCR_COL_TEST

#define LAN8740_BMCR_COL_TEST   0x0080

Definition at line 106 of file lan8740_driver.h.

◆ LAN8740_BMCR_DUPLEX_MODE

#define LAN8740_BMCR_DUPLEX_MODE   0x0100

Definition at line 105 of file lan8740_driver.h.

◆ LAN8740_BMCR_ISOLATE

#define LAN8740_BMCR_ISOLATE   0x0400

Definition at line 103 of file lan8740_driver.h.

◆ LAN8740_BMCR_LOOPBACK

#define LAN8740_BMCR_LOOPBACK   0x4000

Definition at line 99 of file lan8740_driver.h.

◆ LAN8740_BMCR_POWER_DOWN

#define LAN8740_BMCR_POWER_DOWN   0x0800

Definition at line 102 of file lan8740_driver.h.

◆ LAN8740_BMCR_RESET

#define LAN8740_BMCR_RESET   0x8000

Definition at line 98 of file lan8740_driver.h.

◆ LAN8740_BMCR_RESTART_AN

#define LAN8740_BMCR_RESTART_AN   0x0200

Definition at line 104 of file lan8740_driver.h.

◆ LAN8740_BMCR_SPEED_SEL

#define LAN8740_BMCR_SPEED_SEL   0x2000

Definition at line 100 of file lan8740_driver.h.

◆ LAN8740_BMSR

#define LAN8740_BMSR   0x01

Definition at line 46 of file lan8740_driver.h.

◆ LAN8740_BMSR_100BT2_FD

#define LAN8740_BMSR_100BT2_FD   0x0400

Definition at line 114 of file lan8740_driver.h.

◆ LAN8740_BMSR_100BT2_HD

#define LAN8740_BMSR_100BT2_HD   0x0200

Definition at line 115 of file lan8740_driver.h.

◆ LAN8740_BMSR_100BT4

#define LAN8740_BMSR_100BT4   0x8000

Definition at line 109 of file lan8740_driver.h.

◆ LAN8740_BMSR_100BTX_FD

#define LAN8740_BMSR_100BTX_FD   0x4000

Definition at line 110 of file lan8740_driver.h.

◆ LAN8740_BMSR_100BTX_HD

#define LAN8740_BMSR_100BTX_HD   0x2000

Definition at line 111 of file lan8740_driver.h.

◆ LAN8740_BMSR_10BT_FD

#define LAN8740_BMSR_10BT_FD   0x1000

Definition at line 112 of file lan8740_driver.h.

◆ LAN8740_BMSR_10BT_HD

#define LAN8740_BMSR_10BT_HD   0x0800

Definition at line 113 of file lan8740_driver.h.

◆ LAN8740_BMSR_AN_CAPABLE

#define LAN8740_BMSR_AN_CAPABLE   0x0008

Definition at line 119 of file lan8740_driver.h.

◆ LAN8740_BMSR_AN_COMPLETE

#define LAN8740_BMSR_AN_COMPLETE   0x0020

Definition at line 117 of file lan8740_driver.h.

◆ LAN8740_BMSR_EXTENDED_CAPABLE

#define LAN8740_BMSR_EXTENDED_CAPABLE   0x0001

Definition at line 122 of file lan8740_driver.h.

◆ LAN8740_BMSR_EXTENDED_STATUS

#define LAN8740_BMSR_EXTENDED_STATUS   0x0100

Definition at line 116 of file lan8740_driver.h.

◆ LAN8740_BMSR_JABBER_DETECT

#define LAN8740_BMSR_JABBER_DETECT   0x0002

Definition at line 121 of file lan8740_driver.h.

◆ LAN8740_BMSR_LINK_STATUS

#define LAN8740_BMSR_LINK_STATUS   0x0004

Definition at line 120 of file lan8740_driver.h.

◆ LAN8740_BMSR_REMOTE_FAULT

#define LAN8740_BMSR_REMOTE_FAULT   0x0010

Definition at line 118 of file lan8740_driver.h.

◆ LAN8740_CLR

#define LAN8740_CLR   0x1C

Definition at line 63 of file lan8740_driver.h.

◆ LAN8740_CLR_CBLN

#define LAN8740_CLR_CBLN   0xF000

Definition at line 232 of file lan8740_driver.h.

◆ LAN8740_EEE_ADV

#define LAN8740_EEE_ADV   0x07, 0x003C

Definition at line 85 of file lan8740_driver.h.

◆ LAN8740_EEE_CAPABILITY

#define LAN8740_EEE_CAPABILITY   0x03, 0x0014

Definition at line 73 of file lan8740_driver.h.

◆ LAN8740_EEE_LP_ADV

#define LAN8740_EEE_LP_ADV   0x07, 0x003D

Definition at line 86 of file lan8740_driver.h.

◆ LAN8740_EEE_WAKE_ERROR

#define LAN8740_EEE_WAKE_ERROR   0x03, 0x0016

Definition at line 74 of file lan8740_driver.h.

◆ LAN8740_ENCTECR

#define LAN8740_ENCTECR   0x10

Definition at line 56 of file lan8740_driver.h.

◆ LAN8740_ENCTECR_EDPD_EXT_CROSSOVER

#define LAN8740_ENCTECR_EDPD_EXT_CROSSOVER   0x0002

Definition at line 195 of file lan8740_driver.h.

◆ LAN8740_ENCTECR_EDPD_TX_NLP_EN

#define LAN8740_ENCTECR_EDPD_TX_NLP_EN   0x8000

Definition at line 190 of file lan8740_driver.h.

◆ LAN8740_ENCTECR_EDPD_TX_NLP_ITS

#define LAN8740_ENCTECR_EDPD_TX_NLP_ITS   0x6000

Definition at line 191 of file lan8740_driver.h.

◆ LAN8740_ENCTECR_EXT_CROSSOVER_TIME

#define LAN8740_ENCTECR_EXT_CROSSOVER_TIME   0x0001

Definition at line 196 of file lan8740_driver.h.

◆ LAN8740_ENCTECR_PHY_EEE_EN

#define LAN8740_ENCTECR_PHY_EEE_EN   0x0004

Definition at line 194 of file lan8740_driver.h.

◆ LAN8740_ENCTECR_RX_NLP_MIDS

#define LAN8740_ENCTECR_RX_NLP_MIDS   0x0C00

Definition at line 193 of file lan8740_driver.h.

◆ LAN8740_ENCTECR_RX_NLP_WAKE_EN

#define LAN8740_ENCTECR_RX_NLP_WAKE_EN   0x1000

Definition at line 192 of file lan8740_driver.h.

◆ LAN8740_IMR

#define LAN8740_IMR   0x1E

Definition at line 65 of file lan8740_driver.h.

◆ LAN8740_IMR_AN_COMPLETE

#define LAN8740_IMR_AN_COMPLETE   0x0040

Definition at line 247 of file lan8740_driver.h.

◆ LAN8740_IMR_AN_LP_ACK

#define LAN8740_IMR_AN_LP_ACK   0x0008

Definition at line 250 of file lan8740_driver.h.

◆ LAN8740_IMR_AN_PAGE_RECEIVED

#define LAN8740_IMR_AN_PAGE_RECEIVED   0x0002

Definition at line 252 of file lan8740_driver.h.

◆ LAN8740_IMR_ENERGYON

#define LAN8740_IMR_ENERGYON   0x0080

Definition at line 246 of file lan8740_driver.h.

◆ LAN8740_IMR_LINK_DOWN

#define LAN8740_IMR_LINK_DOWN   0x0010

Definition at line 249 of file lan8740_driver.h.

◆ LAN8740_IMR_PAR_DETECT_FAULT

#define LAN8740_IMR_PAR_DETECT_FAULT   0x0004

Definition at line 251 of file lan8740_driver.h.

◆ LAN8740_IMR_REMOTE_FAULT

#define LAN8740_IMR_REMOTE_FAULT   0x0020

Definition at line 248 of file lan8740_driver.h.

◆ LAN8740_IMR_WOL

#define LAN8740_IMR_WOL   0x0100

Definition at line 245 of file lan8740_driver.h.

◆ LAN8740_ISR

#define LAN8740_ISR   0x1D

Definition at line 64 of file lan8740_driver.h.

◆ LAN8740_ISR_AN_COMPLETE

#define LAN8740_ISR_AN_COMPLETE   0x0040

Definition at line 237 of file lan8740_driver.h.

◆ LAN8740_ISR_AN_LP_ACK

#define LAN8740_ISR_AN_LP_ACK   0x0008

Definition at line 240 of file lan8740_driver.h.

◆ LAN8740_ISR_AN_PAGE_RECEIVED

#define LAN8740_ISR_AN_PAGE_RECEIVED   0x0002

Definition at line 242 of file lan8740_driver.h.

◆ LAN8740_ISR_ENERGYON

#define LAN8740_ISR_ENERGYON   0x0080

Definition at line 236 of file lan8740_driver.h.

◆ LAN8740_ISR_LINK_DOWN

#define LAN8740_ISR_LINK_DOWN   0x0010

Definition at line 239 of file lan8740_driver.h.

◆ LAN8740_ISR_PAR_DETECT_FAULT

#define LAN8740_ISR_PAR_DETECT_FAULT   0x0004

Definition at line 241 of file lan8740_driver.h.

◆ LAN8740_ISR_REMOTE_FAULT

#define LAN8740_ISR_REMOTE_FAULT   0x0020

Definition at line 238 of file lan8740_driver.h.

◆ LAN8740_ISR_WOL

#define LAN8740_ISR_WOL   0x0100

Definition at line 235 of file lan8740_driver.h.

◆ LAN8740_MCFGR

#define LAN8740_MCFGR   0x03, 0x8064

Definition at line 82 of file lan8740_driver.h.

◆ LAN8740_MCSR

#define LAN8740_MCSR   0x11

Definition at line 57 of file lan8740_driver.h.

◆ LAN8740_MCSR_ALTINT

#define LAN8740_MCSR_ALTINT   0x0040

Definition at line 201 of file lan8740_driver.h.

◆ LAN8740_MCSR_EDPWRDOWN

#define LAN8740_MCSR_EDPWRDOWN   0x2000

Definition at line 199 of file lan8740_driver.h.

◆ LAN8740_MCSR_ENERGYON

#define LAN8740_MCSR_ENERGYON   0x0002

Definition at line 202 of file lan8740_driver.h.

◆ LAN8740_MCSR_FARLOOPBACK

#define LAN8740_MCSR_FARLOOPBACK   0x0200

Definition at line 200 of file lan8740_driver.h.

◆ LAN8740_MMDAADR

#define LAN8740_MMDAADR   0x0E

Definition at line 55 of file lan8740_driver.h.

◆ LAN8740_MMDACR

#define LAN8740_MMDACR   0x0D

Definition at line 54 of file lan8740_driver.h.

◆ LAN8740_MMDACR_DEVAD

#define LAN8740_MMDACR_DEVAD   0x001F

Definition at line 187 of file lan8740_driver.h.

◆ LAN8740_MMDACR_FUNC

#define LAN8740_MMDACR_FUNC   0xC000

Definition at line 184 of file lan8740_driver.h.

◆ LAN8740_MMDACR_FUNC_ADDR

#define LAN8740_MMDACR_FUNC_ADDR   0x0000

Definition at line 185 of file lan8740_driver.h.

◆ LAN8740_MMDACR_FUNC_DATA_NO_POST_INC

#define LAN8740_MMDACR_FUNC_DATA_NO_POST_INC   0x4000

Definition at line 186 of file lan8740_driver.h.

◆ LAN8740_PCS_CTRL1

#define LAN8740_PCS_CTRL1   0x03, 0x0000

Definition at line 69 of file lan8740_driver.h.

◆ LAN8740_PCS_MMD_DEV_PRES1

#define LAN8740_PCS_MMD_DEV_PRES1   0x03, 0x0005

Definition at line 71 of file lan8740_driver.h.

◆ LAN8740_PCS_MMD_DEV_PRES2

#define LAN8740_PCS_MMD_DEV_PRES2   0x03, 0x0006

Definition at line 72 of file lan8740_driver.h.

◆ LAN8740_PCS_STAT1

#define LAN8740_PCS_STAT1   0x03, 0x0001

Definition at line 70 of file lan8740_driver.h.

◆ LAN8740_PHY_ADDR

#define LAN8740_PHY_ADDR   0

Definition at line 39 of file lan8740_driver.h.

◆ LAN8740_PHYID1

#define LAN8740_PHYID1   0x02

Definition at line 47 of file lan8740_driver.h.

◆ LAN8740_PHYID1_PHY_ID_MSB

#define LAN8740_PHYID1_PHY_ID_MSB   0xFFFF

Definition at line 125 of file lan8740_driver.h.

◆ LAN8740_PHYID1_PHY_ID_MSB_DEFAULT

#define LAN8740_PHYID1_PHY_ID_MSB_DEFAULT   0x0007

Definition at line 126 of file lan8740_driver.h.

◆ LAN8740_PHYID2

#define LAN8740_PHYID2   0x03

Definition at line 48 of file lan8740_driver.h.

◆ LAN8740_PHYID2_MODEL_NUM

#define LAN8740_PHYID2_MODEL_NUM   0x03F0

Definition at line 131 of file lan8740_driver.h.

◆ LAN8740_PHYID2_MODEL_NUM_DEFAULT

#define LAN8740_PHYID2_MODEL_NUM_DEFAULT   0x0110

Definition at line 132 of file lan8740_driver.h.

◆ LAN8740_PHYID2_PHY_ID_LSB

#define LAN8740_PHYID2_PHY_ID_LSB   0xFC00

Definition at line 129 of file lan8740_driver.h.

◆ LAN8740_PHYID2_PHY_ID_LSB_DEFAULT

#define LAN8740_PHYID2_PHY_ID_LSB_DEFAULT   0xC000

Definition at line 130 of file lan8740_driver.h.

◆ LAN8740_PHYID2_REVISION_NUM

#define LAN8740_PHYID2_REVISION_NUM   0x000F

Definition at line 133 of file lan8740_driver.h.

◆ LAN8740_PSCSR

#define LAN8740_PSCSR   0x1F

Definition at line 66 of file lan8740_driver.h.

◆ LAN8740_PSCSR_4B5B_EN

#define LAN8740_PSCSR_4B5B_EN   0x0040

Definition at line 256 of file lan8740_driver.h.

◆ LAN8740_PSCSR_AUTODONE

#define LAN8740_PSCSR_AUTODONE   0x1000

Definition at line 255 of file lan8740_driver.h.

◆ LAN8740_PSCSR_HCDSPEED

#define LAN8740_PSCSR_HCDSPEED   0x001C

Definition at line 257 of file lan8740_driver.h.

◆ LAN8740_PSCSR_HCDSPEED_100BTX_FD

#define LAN8740_PSCSR_HCDSPEED_100BTX_FD   0x0018

Definition at line 261 of file lan8740_driver.h.

◆ LAN8740_PSCSR_HCDSPEED_100BTX_HD

#define LAN8740_PSCSR_HCDSPEED_100BTX_HD   0x0008

Definition at line 259 of file lan8740_driver.h.

◆ LAN8740_PSCSR_HCDSPEED_10BT_FD

#define LAN8740_PSCSR_HCDSPEED_10BT_FD   0x0014

Definition at line 260 of file lan8740_driver.h.

◆ LAN8740_PSCSR_HCDSPEED_10BT_HD

#define LAN8740_PSCSR_HCDSPEED_10BT_HD   0x0004

Definition at line 258 of file lan8740_driver.h.

◆ LAN8740_RX_ADDRA

#define LAN8740_RX_ADDRA   0x03, 0x8061

Definition at line 79 of file lan8740_driver.h.

◆ LAN8740_RX_ADDRB

#define LAN8740_RX_ADDRB   0x03, 0x8062

Definition at line 80 of file lan8740_driver.h.

◆ LAN8740_RX_ADDRC

#define LAN8740_RX_ADDRC   0x03, 0x8063

Definition at line 81 of file lan8740_driver.h.

◆ LAN8740_SCSIR

#define LAN8740_SCSIR   0x1B

Definition at line 62 of file lan8740_driver.h.

◆ LAN8740_SCSIR_AMDIXCTRL

#define LAN8740_SCSIR_AMDIXCTRL   0x8000

Definition at line 226 of file lan8740_driver.h.

◆ LAN8740_SCSIR_CH_SELECT

#define LAN8740_SCSIR_CH_SELECT   0x2000

Definition at line 227 of file lan8740_driver.h.

◆ LAN8740_SCSIR_SQEOFF

#define LAN8740_SCSIR_SQEOFF   0x0800

Definition at line 228 of file lan8740_driver.h.

◆ LAN8740_SCSIR_XPOL

#define LAN8740_SCSIR_XPOL   0x0010

Definition at line 229 of file lan8740_driver.h.

◆ LAN8740_SECR

#define LAN8740_SECR   0x1A

Definition at line 61 of file lan8740_driver.h.

◆ LAN8740_SECR_SYM_ERR_CNT

#define LAN8740_SECR_SYM_ERR_CNT   0xFFFF

Definition at line 223 of file lan8740_driver.h.

◆ LAN8740_SMR

#define LAN8740_SMR   0x12

Definition at line 58 of file lan8740_driver.h.

◆ LAN8740_SMR_MIIMODE

#define LAN8740_SMR_MIIMODE   0x4000

Definition at line 205 of file lan8740_driver.h.

◆ LAN8740_SMR_MODE

#define LAN8740_SMR_MODE   0x00E0

Definition at line 206 of file lan8740_driver.h.

◆ LAN8740_SMR_PHYAD

#define LAN8740_SMR_PHYAD   0x001F

Definition at line 207 of file lan8740_driver.h.

◆ LAN8740_TDR_MATCH_THRESHOLD

#define LAN8740_TDR_MATCH_THRESHOLD   0x1E, 0x000B

Definition at line 92 of file lan8740_driver.h.

◆ LAN8740_TDR_SHORT_OPEN_THRESHOLD

#define LAN8740_TDR_SHORT_OPEN_THRESHOLD   0x1E, 0x000C

Definition at line 93 of file lan8740_driver.h.

◆ LAN8740_TDRCSR

#define LAN8740_TDRCSR   0x19

Definition at line 60 of file lan8740_driver.h.

◆ LAN8740_TDRCSR_AD_FILTER_EN

#define LAN8740_TDRCSR_AD_FILTER_EN   0x4000

Definition at line 217 of file lan8740_driver.h.

◆ LAN8740_TDRCSR_CH_CABLE_TYPE

#define LAN8740_TDRCSR_CH_CABLE_TYPE   0x0600

Definition at line 218 of file lan8740_driver.h.

◆ LAN8740_TDRCSR_CH_LENGTH

#define LAN8740_TDRCSR_CH_LENGTH   0x00FF

Definition at line 220 of file lan8740_driver.h.

◆ LAN8740_TDRCSR_CH_STATUS

#define LAN8740_TDRCSR_CH_STATUS   0x0100

Definition at line 219 of file lan8740_driver.h.

◆ LAN8740_TDRCSR_TDR_EN

#define LAN8740_TDRCSR_TDR_EN   0x8000

Definition at line 216 of file lan8740_driver.h.

◆ LAN8740_TDRPDCR

#define LAN8740_TDRPDCR   0x18

Definition at line 59 of file lan8740_driver.h.

◆ LAN8740_TDRPDCR_DELAY_IN

#define LAN8740_TDRPDCR_DELAY_IN   0x8000

Definition at line 210 of file lan8740_driver.h.

◆ LAN8740_TDRPDCR_LINE_BREAK_COUNT

#define LAN8740_TDRPDCR_LINE_BREAK_COUNT   0x7000

Definition at line 211 of file lan8740_driver.h.

◆ LAN8740_TDRPDCR_PATTERN_HIGH

#define LAN8740_TDRPDCR_PATTERN_HIGH   0x0FC0

Definition at line 212 of file lan8740_driver.h.

◆ LAN8740_TDRPDCR_PATTERN_LOW

#define LAN8740_TDRPDCR_PATTERN_LOW   0x003F

Definition at line 213 of file lan8740_driver.h.

◆ LAN8740_VENDOR_SPECIFIC_MMD1_DEV_ID1

#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_ID1   0x1E, 0x0002

Definition at line 87 of file lan8740_driver.h.

◆ LAN8740_VENDOR_SPECIFIC_MMD1_DEV_ID2

#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_ID2   0x1E, 0x0003

Definition at line 88 of file lan8740_driver.h.

◆ LAN8740_VENDOR_SPECIFIC_MMD1_DEV_PRES1

#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_PRES1   0x1E, 0x0005

Definition at line 89 of file lan8740_driver.h.

◆ LAN8740_VENDOR_SPECIFIC_MMD1_DEV_PRES2

#define LAN8740_VENDOR_SPECIFIC_MMD1_DEV_PRES2   0x1E, 0x0006

Definition at line 90 of file lan8740_driver.h.

◆ LAN8740_VENDOR_SPECIFIC_MMD1_PKG_ID1

#define LAN8740_VENDOR_SPECIFIC_MMD1_PKG_ID1   0x1E, 0x000E

Definition at line 94 of file lan8740_driver.h.

◆ LAN8740_VENDOR_SPECIFIC_MMD1_PKG_ID2

#define LAN8740_VENDOR_SPECIFIC_MMD1_PKG_ID2   0x1E, 0x000F

Definition at line 95 of file lan8740_driver.h.

◆ LAN8740_VENDOR_SPECIFIC_MMD1_STAT

#define LAN8740_VENDOR_SPECIFIC_MMD1_STAT   0x1E, 0x0008

Definition at line 91 of file lan8740_driver.h.

◆ LAN8740_WUCSR

#define LAN8740_WUCSR   0x03, 0x8010

Definition at line 75 of file lan8740_driver.h.

◆ LAN8740_WUF_CFGA

#define LAN8740_WUF_CFGA   0x03, 0x8011

Definition at line 76 of file lan8740_driver.h.

◆ LAN8740_WUF_CFGB

#define LAN8740_WUF_CFGB   0x03, 0x8012

Definition at line 77 of file lan8740_driver.h.

◆ LAN8740_WUF_MASK

#define LAN8740_WUF_MASK   0x03, 0x8021

Definition at line 78 of file lan8740_driver.h.

Function Documentation

◆ lan8740DisableIrq()

void lan8740DisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 180 of file lan8740_driver.c.

◆ lan8740DumpPhyReg()

void lan8740DumpPhyReg ( NetInterface interface)

Dump PHY registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface

Definition at line 325 of file lan8740_driver.c.

◆ lan8740EnableIrq()

void lan8740EnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 165 of file lan8740_driver.c.

◆ lan8740EventHandler()

void lan8740EventHandler ( NetInterface interface)

LAN8740 event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 195 of file lan8740_driver.c.

◆ lan8740Init()

error_t lan8740Init ( NetInterface interface)

LAN8740 PHY transceiver initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 60 of file lan8740_driver.c.

◆ lan8740InitHook()

void lan8740InitHook ( NetInterface interface)

LAN8740 custom configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 117 of file lan8740_driver.c.

◆ lan8740ReadMmdReg()

uint16_t lan8740ReadMmdReg ( NetInterface interface,
uint8_t  devAddr,
uint16_t  regAddr 
)

Read MMD register.

Parameters
[in]interfaceUnderlying network interface
[in]devAddrDevice address
[in]regAddrRegister address
Returns
MMD register value

Definition at line 377 of file lan8740_driver.c.

◆ lan8740ReadPhyReg()

uint16_t lan8740ReadPhyReg ( NetInterface interface,
uint8_t  address 
)

Read PHY register.

Parameters
[in]interfaceUnderlying network interface
[in]addressPHY register address
Returns
Register value

Definition at line 299 of file lan8740_driver.c.

◆ lan8740Tick()

void lan8740Tick ( NetInterface interface)

LAN8740 timer handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 127 of file lan8740_driver.c.

◆ lan8740WriteMmdReg()

void lan8740WriteMmdReg ( NetInterface interface,
uint8_t  devAddr,
uint16_t  regAddr,
uint16_t  data 
)

Write MMD register.

Parameters
[in]interfaceUnderlying network interface
[in]devAddrDevice address
[in]regAddrRegister address
[in]dataMMD register value

Definition at line 350 of file lan8740_driver.c.

◆ lan8740WritePhyReg()

void lan8740WritePhyReg ( NetInterface interface,
uint8_t  address,
uint16_t  data 
)

Write PHY register.

Parameters
[in]interfaceUnderlying network interface
[in]addressPHY register address
[in]dataRegister value

Definition at line 275 of file lan8740_driver.c.

Variable Documentation

◆ lan8740PhyDriver

const PhyDriver lan8740PhyDriver
extern

LAN8740 Ethernet PHY driver.

Definition at line 44 of file lan8740_driver.c.