lan8742_driver.h File Reference

LAN8742 Ethernet PHY transceiver. More...

#include "core/nic.h"

Go to the source code of this file.

Macros

#define LAN8742_PHY_ADDR   0
 
#define LAN8742_PHY_REG_BMCR   0x00
 
#define LAN8742_PHY_REG_BMSR   0x01
 
#define LAN8742_PHY_REG_PHYIDR1   0x02
 
#define LAN8742_PHY_REG_PHYIDR2   0x03
 
#define LAN8742_PHY_REG_ANAR   0x04
 
#define LAN8742_PHY_REG_ANLPAR   0x05
 
#define LAN8742_PHY_REG_ANER   0x06
 
#define LAN8742_PHY_REG_ANNPTR   0x07
 
#define LAN8742_PHY_REG_ANNPRR   0x08
 
#define LAN8742_PHY_REG_MMDACR   0x0D
 
#define LAN8742_PHY_REG_MMDAADR   0x0E
 
#define LAN8742_PHY_REG_ENCTR   0x10
 
#define LAN8742_PHY_REG_MCSR   0x11
 
#define LAN8742_PHY_REG_SMR   0x12
 
#define LAN8742_PHY_REG_TDRPDCR   0x18
 
#define LAN8742_PHY_REG_TDRCSR   0x19
 
#define LAN8742_PHY_REG_SECR   0x1A
 
#define LAN8742_PHY_REG_SCSIR   0x1B
 
#define LAN8742_PHY_REG_CLR   0x1C
 
#define LAN8742_PHY_REG_ISR   0x1D
 
#define LAN8742_PHY_REG_IMR   0x1E
 
#define LAN8742_PHY_REG_PSCSR   0x1F
 
#define BMCR_RESET   (1 << 15)
 
#define BMCR_LOOPBACK   (1 << 14)
 
#define BMCR_SPEED_SEL   (1 << 13)
 
#define BMCR_AN_EN   (1 << 12)
 
#define BMCR_POWER_DOWN   (1 << 11)
 
#define BMCR_ISOLATE   (1 << 10)
 
#define BMCR_RESTART_AN   (1 << 9)
 
#define BMCR_DUPLEX_MODE   (1 << 8)
 
#define BMCR_COL_TEST   (1 << 7)
 
#define BMSR_100BT4   (1 << 15)
 
#define BMSR_100BTX_FD   (1 << 14)
 
#define BMSR_100BTX   (1 << 13)
 
#define BMSR_10BT_FD   (1 << 12)
 
#define BMSR_10BT   (1 << 11)
 
#define BMSR_100BT2_FD   (1 << 10)
 
#define BMSR_100BT2   (1 << 9)
 
#define BMSR_EXTENTED_STATUS   (1 << 8)
 
#define BMSR_AN_COMPLETE   (1 << 5)
 
#define BMSR_REMOTE_FAULT   (1 << 4)
 
#define BMSR_AN_ABLE   (1 << 3)
 
#define BMSR_LINK_STATUS   (1 << 2)
 
#define BMSR_JABBER_DETECT   (1 << 1)
 
#define BMSR_EXTENDED_CAP   (1 << 0)
 
#define ANAR_NP   (1 << 15)
 
#define ANAR_RF   (1 << 13)
 
#define ANAR_PAUSE1   (1 << 11)
 
#define ANAR_PAUSE0   (1 << 10)
 
#define ANAR_100BTX_FD   (1 << 8)
 
#define ANAR_100BTX   (1 << 7)
 
#define ANAR_10BT_FD   (1 << 6)
 
#define ANAR_10BT   (1 << 5)
 
#define ANAR_SELECTOR4   (1 << 4)
 
#define ANAR_SELECTOR3   (1 << 3)
 
#define ANAR_SELECTOR2   (1 << 2)
 
#define ANAR_SELECTOR1   (1 << 1)
 
#define ANAR_SELECTOR0   (1 << 0)
 
#define ANLPAR_NP   (1 << 15)
 
#define ANLPAR_ACK   (1 << 14)
 
#define ANLPAR_RF   (1 << 13)
 
#define ANLPAR_PAUSE1   (1 << 11)
 
#define ANLPAR_PAUSE0   (1 << 10)
 
#define ANLPAR_100BT4   (1 << 9)
 
#define ANLPAR_100BTX_FD   (1 << 8)
 
#define ANLPAR_100BTX   (1 << 7)
 
#define ANLPAR_10BT_FD   (1 << 6)
 
#define ANLPAR_10BT   (1 << 5)
 
#define ANLPAR_SELECTOR4   (1 << 4)
 
#define ANLPAR_SELECTOR3   (1 << 3)
 
#define ANLPAR_SELECTOR2   (1 << 2)
 
#define ANLPAR_SELECTOR1   (1 << 1)
 
#define ANLPAR_SELECTOR0   (1 << 0)
 
#define ANER_RX_NP_LOC_ABLE   (1 << 6)
 
#define ANER_RX_NP_STOR_LOC   (1 << 5)
 
#define ANER_PDF   (1 << 4)
 
#define ANER_LP_NP_ABLE   (1 << 3)
 
#define ANER_NP_ABLE   (1 << 2)
 
#define ANER_PAGE_RX   (1 << 1)
 
#define ANER_LP_AN_ABLE   (1 << 0)
 
#define ANNPTR_NEXT_PAGE   (1 << 15)
 
#define ANNPTR_MSG_PAGE   (1 << 13)
 
#define ANNPTR_ACK2   (1 << 12)
 
#define ANNPTR_TOGGLE   (1 << 11)
 
#define ANNPTR_MESSAGE10   (1 << 10)
 
#define ANNPTR_MESSAGE9   (1 << 9)
 
#define ANNPTR_MESSAGE8   (1 << 8)
 
#define ANNPTR_MESSAGE7   (1 << 7)
 
#define ANNPTR_MESSAGE6   (1 << 6)
 
#define ANNPTR_MESSAGE5   (1 << 5)
 
#define ANNPTR_MESSAGE4   (1 << 4)
 
#define ANNPTR_MESSAGE3   (1 << 3)
 
#define ANNPTR_MESSAGE2   (1 << 2)
 
#define ANNPTR_MESSAGE1   (1 << 1)
 
#define ANNPTR_MESSAGE0   (1 << 0)
 
#define ANNPRR_NEXT_PAGE   (1 << 15)
 
#define ANNPRR_ACK   (1 << 14)
 
#define ANNPRR_MSG_PAGE   (1 << 13)
 
#define ANNPRR_ACK2   (1 << 12)
 
#define ANNPRR_TOGGLE   (1 << 11)
 
#define ANNPRR_MESSAGE10   (1 << 10)
 
#define ANNPRR_MESSAGE9   (1 << 9)
 
#define ANNPRR_MESSAGE8   (1 << 8)
 
#define ANNPRR_MESSAGE7   (1 << 7)
 
#define ANNPRR_MESSAGE6   (1 << 6)
 
#define ANNPRR_MESSAGE5   (1 << 5)
 
#define ANNPRR_MESSAGE4   (1 << 4)
 
#define ANNPRR_MESSAGE3   (1 << 3)
 
#define ANNPRR_MESSAGE2   (1 << 2)
 
#define ANNPRR_MESSAGE1   (1 << 1)
 
#define ANNPRR_MESSAGE0   (1 << 0)
 
#define MMDACR_FUNCTION1   (1 << 15)
 
#define MMDACR_FUNCTION0   (1 << 14)
 
#define MMDACR_DEVAD4   (1 << 4)
 
#define MMDACR_DEVAD3   (1 << 3)
 
#define MMDACR_DEVAD2   (1 << 2)
 
#define MMDACR_DEVAD1   (1 << 1)
 
#define MMDACR_DEVAD0   (1 << 0)
 
#define ENCTR_EDPD_TX_NLP_EN   (1 << 15)
 
#define ENCTR_EDPD_TX_NLP_ITS1   (1 << 14)
 
#define ENCTR_EDPD_TX_NLP_ITS0   (1 << 13)
 
#define ENCTR_EDPD_RX_NLP_WAKE_EN   (1 << 12)
 
#define ENCTR_EDPD_RX_NLP_MIDS1   (1 << 11)
 
#define ENCTR_EDPD_RX_NLP_MIDS0   (1 << 10)
 
#define ENCTR_EDPD_EXT_CROSSOVER   (1 << 1)
 
#define ENCTR_EXT_CROSSOVER_TIME   (1 << 0)
 
#define MCSR_EDPWRDOWN   (1 << 13)
 
#define MCSR_FARLOOPBACK   (1 << 9)
 
#define MCSR_ALTINT   (1 << 6)
 
#define MCSR_ENERGYON   (1 << 1)
 
#define SMR_MODE2   (1 << 7)
 
#define SMR_MODE1   (1 << 6)
 
#define SMR_MODE0   (1 << 5)
 
#define SMR_PHYAD4   (1 << 4)
 
#define SMR_PHYAD3   (1 << 3)
 
#define SMR_PHYAD2   (1 << 2)
 
#define SMR_PHYAD1   (1 << 1)
 
#define SMR_PHYAD0   (1 << 0)
 
#define TDRPDCR_DELAY_IN   (1 << 15)
 
#define TDRPDCR_LINE_BREAK_COUNTER2   (1 << 14)
 
#define TDRPDCR_LINE_BREAK_COUNTER1   (1 << 13)
 
#define TDRPDCR_LINE_BREAK_COUNTER0   (1 << 12)
 
#define TDRPDCR_PATTERN_HIGH5   (1 << 11)
 
#define TDRPDCR_PATTERN_HIGH4   (1 << 10)
 
#define TDRPDCR_PATTERN_HIGH3   (1 << 9)
 
#define TDRPDCR_PATTERN_HIGH2   (1 << 8)
 
#define TDRPDCR_PATTERN_HIGH1   (1 << 7)
 
#define TDRPDCR_PATTERN_HIGH0   (1 << 6)
 
#define TDRPDCR_PATTERN_LOW5   (1 << 5)
 
#define TDRPDCR_PATTERN_LOW4   (1 << 4)
 
#define TDRPDCR_PATTERN_LOW3   (1 << 3)
 
#define TDRPDCR_PATTERN_LOW2   (1 << 2)
 
#define TDRPDCR_PATTERN_LOW1   (1 << 1)
 
#define TDRPDCR_PATTERN_LOW0   (1 << 0)
 
#define TDRCSR_EN   (1 << 15)
 
#define TDRCSR_AD_FILTER_EN   (1 << 14)
 
#define TDRCSR_CH_CABLE_TYPE1   (1 << 10)
 
#define TDRCSR_CH_CABLE_TYPE0   (1 << 9)
 
#define TDRCSR_CH_STATUS   (1 << 8)
 
#define TDRCSR_CH_LENGTH7   (1 << 7)
 
#define TDRCSR_CH_LENGTH6   (1 << 6)
 
#define TDRCSR_CH_LENGTH5   (1 << 5)
 
#define TDRCSR_CH_LENGTH4   (1 << 4)
 
#define TDRCSR_CH_LENGTH3   (1 << 3)
 
#define TDRCSR_CH_LENGTH2   (1 << 2)
 
#define TDRCSR_CH_LENGTH1   (1 << 1)
 
#define TDRCSR_CH_LENGTH0   (1 << 0)
 
#define SCSIR_AMDIXCTRL   (1 << 15)
 
#define SCSIR_CH_SELECT   (1 << 13)
 
#define SCSIR_SQEOFF   (1 << 11)
 
#define SCSIR_XPOL   (1 << 4)
 
#define CLR_CBLN3   (1 << 15)
 
#define CLR_CBLN2   (1 << 14)
 
#define CLR_CBLN1   (1 << 13)
 
#define CLR_CBLN0   (1 << 12)
 
#define ISR_WOL   (1 << 8)
 
#define ISR_ENERGYON   (1 << 7)
 
#define ISR_AN_COMPLETE   (1 << 6)
 
#define ISR_REMOTE_FAULT   (1 << 5)
 
#define ISR_LINK_DOWN   (1 << 4)
 
#define ISR_AN_LP_ACK   (1 << 3)
 
#define ISR_PD_FAULT   (1 << 2)
 
#define ISR_AN_PAGE_RECEIVED   (1 << 1)
 
#define IMR_WOL   (1 << 8)
 
#define IMR_ENERGYON   (1 << 7)
 
#define IMR_AN_COMPLETE   (1 << 6)
 
#define IMR_REMOTE_FAULT   (1 << 5)
 
#define IMR_LINK_DOWN   (1 << 4)
 
#define IMR_AN_LP_ACK   (1 << 3)
 
#define IMR_PD_FAULT   (1 << 2)
 
#define IMR_AN_PAGE_RECEIVED   (1 << 1)
 
#define PSCSR_AUTODONE   (1 << 12)
 
#define PSCSR_HCDSPEED2   (1 << 4)
 
#define PSCSR_HCDSPEED1   (1 << 3)
 
#define PSCSR_HCDSPEED0   (1 << 2)
 
#define PSCSR_HCDSPEED_MASK   (7 << 2)
 
#define PSCSR_HCDSPEED_10BT   (1 << 2)
 
#define PSCSR_HCDSPEED_100BTX   (2 << 2)
 
#define PSCSR_HCDSPEED_10BT_FD   (5 << 2)
 
#define PSCSR_HCDSPEED_100BTX_FD   (6 << 2)
 

Functions

error_t lan8742Init (NetInterface *interface)
 LAN8742 PHY transceiver initialization. More...
 
void lan8742Tick (NetInterface *interface)
 LAN8742 timer handler. More...
 
void lan8742EnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void lan8742DisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
void lan8742EventHandler (NetInterface *interface)
 LAN8742 event handler. More...
 
void lan8742WritePhyReg (NetInterface *interface, uint8_t address, uint16_t data)
 Write PHY register. More...
 
uint16_t lan8742ReadPhyReg (NetInterface *interface, uint8_t address)
 Read PHY register. More...
 
void lan8742DumpPhyReg (NetInterface *interface)
 Dump PHY registers for debugging purpose. More...
 

Variables

const PhyDriver lan8742PhyDriver
 LAN8742 Ethernet PHY driver. More...
 

Detailed Description

LAN8742 Ethernet PHY transceiver.

License

Copyright (C) 2010-2018 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
1.9.0

Definition in file lan8742_driver.h.

Macro Definition Documentation

◆ ANAR_100BTX

#define ANAR_100BTX   (1 << 7)

Definition at line 99 of file lan8742_driver.h.

◆ ANAR_100BTX_FD

#define ANAR_100BTX_FD   (1 << 8)

Definition at line 98 of file lan8742_driver.h.

◆ ANAR_10BT

#define ANAR_10BT   (1 << 5)

Definition at line 101 of file lan8742_driver.h.

◆ ANAR_10BT_FD

#define ANAR_10BT_FD   (1 << 6)

Definition at line 100 of file lan8742_driver.h.

◆ ANAR_NP

#define ANAR_NP   (1 << 15)

Definition at line 94 of file lan8742_driver.h.

◆ ANAR_PAUSE0

#define ANAR_PAUSE0   (1 << 10)

Definition at line 97 of file lan8742_driver.h.

◆ ANAR_PAUSE1

#define ANAR_PAUSE1   (1 << 11)

Definition at line 96 of file lan8742_driver.h.

◆ ANAR_RF

#define ANAR_RF   (1 << 13)

Definition at line 95 of file lan8742_driver.h.

◆ ANAR_SELECTOR0

#define ANAR_SELECTOR0   (1 << 0)

Definition at line 106 of file lan8742_driver.h.

◆ ANAR_SELECTOR1

#define ANAR_SELECTOR1   (1 << 1)

Definition at line 105 of file lan8742_driver.h.

◆ ANAR_SELECTOR2

#define ANAR_SELECTOR2   (1 << 2)

Definition at line 104 of file lan8742_driver.h.

◆ ANAR_SELECTOR3

#define ANAR_SELECTOR3   (1 << 3)

Definition at line 103 of file lan8742_driver.h.

◆ ANAR_SELECTOR4

#define ANAR_SELECTOR4   (1 << 4)

Definition at line 102 of file lan8742_driver.h.

◆ ANER_LP_AN_ABLE

#define ANER_LP_AN_ABLE   (1 << 0)

Definition at line 132 of file lan8742_driver.h.

◆ ANER_LP_NP_ABLE

#define ANER_LP_NP_ABLE   (1 << 3)

Definition at line 129 of file lan8742_driver.h.

◆ ANER_NP_ABLE

#define ANER_NP_ABLE   (1 << 2)

Definition at line 130 of file lan8742_driver.h.

◆ ANER_PAGE_RX

#define ANER_PAGE_RX   (1 << 1)

Definition at line 131 of file lan8742_driver.h.

◆ ANER_PDF

#define ANER_PDF   (1 << 4)

Definition at line 128 of file lan8742_driver.h.

◆ ANER_RX_NP_LOC_ABLE

#define ANER_RX_NP_LOC_ABLE   (1 << 6)

Definition at line 126 of file lan8742_driver.h.

◆ ANER_RX_NP_STOR_LOC

#define ANER_RX_NP_STOR_LOC   (1 << 5)

Definition at line 127 of file lan8742_driver.h.

◆ ANLPAR_100BT4

#define ANLPAR_100BT4   (1 << 9)

Definition at line 114 of file lan8742_driver.h.

◆ ANLPAR_100BTX

#define ANLPAR_100BTX   (1 << 7)

Definition at line 116 of file lan8742_driver.h.

◆ ANLPAR_100BTX_FD

#define ANLPAR_100BTX_FD   (1 << 8)

Definition at line 115 of file lan8742_driver.h.

◆ ANLPAR_10BT

#define ANLPAR_10BT   (1 << 5)

Definition at line 118 of file lan8742_driver.h.

◆ ANLPAR_10BT_FD

#define ANLPAR_10BT_FD   (1 << 6)

Definition at line 117 of file lan8742_driver.h.

◆ ANLPAR_ACK

#define ANLPAR_ACK   (1 << 14)

Definition at line 110 of file lan8742_driver.h.

◆ ANLPAR_NP

#define ANLPAR_NP   (1 << 15)

Definition at line 109 of file lan8742_driver.h.

◆ ANLPAR_PAUSE0

#define ANLPAR_PAUSE0   (1 << 10)

Definition at line 113 of file lan8742_driver.h.

◆ ANLPAR_PAUSE1

#define ANLPAR_PAUSE1   (1 << 11)

Definition at line 112 of file lan8742_driver.h.

◆ ANLPAR_RF

#define ANLPAR_RF   (1 << 13)

Definition at line 111 of file lan8742_driver.h.

◆ ANLPAR_SELECTOR0

#define ANLPAR_SELECTOR0   (1 << 0)

Definition at line 123 of file lan8742_driver.h.

◆ ANLPAR_SELECTOR1

#define ANLPAR_SELECTOR1   (1 << 1)

Definition at line 122 of file lan8742_driver.h.

◆ ANLPAR_SELECTOR2

#define ANLPAR_SELECTOR2   (1 << 2)

Definition at line 121 of file lan8742_driver.h.

◆ ANLPAR_SELECTOR3

#define ANLPAR_SELECTOR3   (1 << 3)

Definition at line 120 of file lan8742_driver.h.

◆ ANLPAR_SELECTOR4

#define ANLPAR_SELECTOR4   (1 << 4)

Definition at line 119 of file lan8742_driver.h.

◆ ANNPRR_ACK

#define ANNPRR_ACK   (1 << 14)

Definition at line 153 of file lan8742_driver.h.

◆ ANNPRR_ACK2

#define ANNPRR_ACK2   (1 << 12)

Definition at line 155 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE0

#define ANNPRR_MESSAGE0   (1 << 0)

Definition at line 167 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE1

#define ANNPRR_MESSAGE1   (1 << 1)

Definition at line 166 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE10

#define ANNPRR_MESSAGE10   (1 << 10)

Definition at line 157 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE2

#define ANNPRR_MESSAGE2   (1 << 2)

Definition at line 165 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE3

#define ANNPRR_MESSAGE3   (1 << 3)

Definition at line 164 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE4

#define ANNPRR_MESSAGE4   (1 << 4)

Definition at line 163 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE5

#define ANNPRR_MESSAGE5   (1 << 5)

Definition at line 162 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE6

#define ANNPRR_MESSAGE6   (1 << 6)

Definition at line 161 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE7

#define ANNPRR_MESSAGE7   (1 << 7)

Definition at line 160 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE8

#define ANNPRR_MESSAGE8   (1 << 8)

Definition at line 159 of file lan8742_driver.h.

◆ ANNPRR_MESSAGE9

#define ANNPRR_MESSAGE9   (1 << 9)

Definition at line 158 of file lan8742_driver.h.

◆ ANNPRR_MSG_PAGE

#define ANNPRR_MSG_PAGE   (1 << 13)

Definition at line 154 of file lan8742_driver.h.

◆ ANNPRR_NEXT_PAGE

#define ANNPRR_NEXT_PAGE   (1 << 15)

Definition at line 152 of file lan8742_driver.h.

◆ ANNPRR_TOGGLE

#define ANNPRR_TOGGLE   (1 << 11)

Definition at line 156 of file lan8742_driver.h.

◆ ANNPTR_ACK2

#define ANNPTR_ACK2   (1 << 12)

Definition at line 137 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE0

#define ANNPTR_MESSAGE0   (1 << 0)

Definition at line 149 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE1

#define ANNPTR_MESSAGE1   (1 << 1)

Definition at line 148 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE10

#define ANNPTR_MESSAGE10   (1 << 10)

Definition at line 139 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE2

#define ANNPTR_MESSAGE2   (1 << 2)

Definition at line 147 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE3

#define ANNPTR_MESSAGE3   (1 << 3)

Definition at line 146 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE4

#define ANNPTR_MESSAGE4   (1 << 4)

Definition at line 145 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE5

#define ANNPTR_MESSAGE5   (1 << 5)

Definition at line 144 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE6

#define ANNPTR_MESSAGE6   (1 << 6)

Definition at line 143 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE7

#define ANNPTR_MESSAGE7   (1 << 7)

Definition at line 142 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE8

#define ANNPTR_MESSAGE8   (1 << 8)

Definition at line 141 of file lan8742_driver.h.

◆ ANNPTR_MESSAGE9

#define ANNPTR_MESSAGE9   (1 << 9)

Definition at line 140 of file lan8742_driver.h.

◆ ANNPTR_MSG_PAGE

#define ANNPTR_MSG_PAGE   (1 << 13)

Definition at line 136 of file lan8742_driver.h.

◆ ANNPTR_NEXT_PAGE

#define ANNPTR_NEXT_PAGE   (1 << 15)

Definition at line 135 of file lan8742_driver.h.

◆ ANNPTR_TOGGLE

#define ANNPTR_TOGGLE   (1 << 11)

Definition at line 138 of file lan8742_driver.h.

◆ BMCR_AN_EN

#define BMCR_AN_EN   (1 << 12)

Definition at line 70 of file lan8742_driver.h.

◆ BMCR_COL_TEST

#define BMCR_COL_TEST   (1 << 7)

Definition at line 75 of file lan8742_driver.h.

◆ BMCR_DUPLEX_MODE

#define BMCR_DUPLEX_MODE   (1 << 8)

Definition at line 74 of file lan8742_driver.h.

◆ BMCR_ISOLATE

#define BMCR_ISOLATE   (1 << 10)

Definition at line 72 of file lan8742_driver.h.

◆ BMCR_LOOPBACK

#define BMCR_LOOPBACK   (1 << 14)

Definition at line 68 of file lan8742_driver.h.

◆ BMCR_POWER_DOWN

#define BMCR_POWER_DOWN   (1 << 11)

Definition at line 71 of file lan8742_driver.h.

◆ BMCR_RESET

#define BMCR_RESET   (1 << 15)

Definition at line 67 of file lan8742_driver.h.

◆ BMCR_RESTART_AN

#define BMCR_RESTART_AN   (1 << 9)

Definition at line 73 of file lan8742_driver.h.

◆ BMCR_SPEED_SEL

#define BMCR_SPEED_SEL   (1 << 13)

Definition at line 69 of file lan8742_driver.h.

◆ BMSR_100BT2

#define BMSR_100BT2   (1 << 9)

Definition at line 84 of file lan8742_driver.h.

◆ BMSR_100BT2_FD

#define BMSR_100BT2_FD   (1 << 10)

Definition at line 83 of file lan8742_driver.h.

◆ BMSR_100BT4

#define BMSR_100BT4   (1 << 15)

Definition at line 78 of file lan8742_driver.h.

◆ BMSR_100BTX

#define BMSR_100BTX   (1 << 13)

Definition at line 80 of file lan8742_driver.h.

◆ BMSR_100BTX_FD

#define BMSR_100BTX_FD   (1 << 14)

Definition at line 79 of file lan8742_driver.h.

◆ BMSR_10BT

#define BMSR_10BT   (1 << 11)

Definition at line 82 of file lan8742_driver.h.

◆ BMSR_10BT_FD

#define BMSR_10BT_FD   (1 << 12)

Definition at line 81 of file lan8742_driver.h.

◆ BMSR_AN_ABLE

#define BMSR_AN_ABLE   (1 << 3)

Definition at line 88 of file lan8742_driver.h.

◆ BMSR_AN_COMPLETE

#define BMSR_AN_COMPLETE   (1 << 5)

Definition at line 86 of file lan8742_driver.h.

◆ BMSR_EXTENDED_CAP

#define BMSR_EXTENDED_CAP   (1 << 0)

Definition at line 91 of file lan8742_driver.h.

◆ BMSR_EXTENTED_STATUS

#define BMSR_EXTENTED_STATUS   (1 << 8)

Definition at line 85 of file lan8742_driver.h.

◆ BMSR_JABBER_DETECT

#define BMSR_JABBER_DETECT   (1 << 1)

Definition at line 90 of file lan8742_driver.h.

◆ BMSR_LINK_STATUS

#define BMSR_LINK_STATUS   (1 << 2)

Definition at line 89 of file lan8742_driver.h.

◆ BMSR_REMOTE_FAULT

#define BMSR_REMOTE_FAULT   (1 << 4)

Definition at line 87 of file lan8742_driver.h.

◆ CLR_CBLN0

#define CLR_CBLN0   (1 << 12)

Definition at line 247 of file lan8742_driver.h.

◆ CLR_CBLN1

#define CLR_CBLN1   (1 << 13)

Definition at line 246 of file lan8742_driver.h.

◆ CLR_CBLN2

#define CLR_CBLN2   (1 << 14)

Definition at line 245 of file lan8742_driver.h.

◆ CLR_CBLN3

#define CLR_CBLN3   (1 << 15)

Definition at line 244 of file lan8742_driver.h.

◆ ENCTR_EDPD_EXT_CROSSOVER

#define ENCTR_EDPD_EXT_CROSSOVER   (1 << 1)

Definition at line 185 of file lan8742_driver.h.

◆ ENCTR_EDPD_RX_NLP_MIDS0

#define ENCTR_EDPD_RX_NLP_MIDS0   (1 << 10)

Definition at line 184 of file lan8742_driver.h.

◆ ENCTR_EDPD_RX_NLP_MIDS1

#define ENCTR_EDPD_RX_NLP_MIDS1   (1 << 11)

Definition at line 183 of file lan8742_driver.h.

◆ ENCTR_EDPD_RX_NLP_WAKE_EN

#define ENCTR_EDPD_RX_NLP_WAKE_EN   (1 << 12)

Definition at line 182 of file lan8742_driver.h.

◆ ENCTR_EDPD_TX_NLP_EN

#define ENCTR_EDPD_TX_NLP_EN   (1 << 15)

Definition at line 179 of file lan8742_driver.h.

◆ ENCTR_EDPD_TX_NLP_ITS0

#define ENCTR_EDPD_TX_NLP_ITS0   (1 << 13)

Definition at line 181 of file lan8742_driver.h.

◆ ENCTR_EDPD_TX_NLP_ITS1

#define ENCTR_EDPD_TX_NLP_ITS1   (1 << 14)

Definition at line 180 of file lan8742_driver.h.

◆ ENCTR_EXT_CROSSOVER_TIME

#define ENCTR_EXT_CROSSOVER_TIME   (1 << 0)

Definition at line 186 of file lan8742_driver.h.

◆ IMR_AN_COMPLETE

#define IMR_AN_COMPLETE   (1 << 6)

Definition at line 262 of file lan8742_driver.h.

◆ IMR_AN_LP_ACK

#define IMR_AN_LP_ACK   (1 << 3)

Definition at line 265 of file lan8742_driver.h.

◆ IMR_AN_PAGE_RECEIVED

#define IMR_AN_PAGE_RECEIVED   (1 << 1)

Definition at line 267 of file lan8742_driver.h.

◆ IMR_ENERGYON

#define IMR_ENERGYON   (1 << 7)

Definition at line 261 of file lan8742_driver.h.

◆ IMR_LINK_DOWN

#define IMR_LINK_DOWN   (1 << 4)

Definition at line 264 of file lan8742_driver.h.

◆ IMR_PD_FAULT

#define IMR_PD_FAULT   (1 << 2)

Definition at line 266 of file lan8742_driver.h.

◆ IMR_REMOTE_FAULT

#define IMR_REMOTE_FAULT   (1 << 5)

Definition at line 263 of file lan8742_driver.h.

◆ IMR_WOL

#define IMR_WOL   (1 << 8)

Definition at line 260 of file lan8742_driver.h.

◆ ISR_AN_COMPLETE

#define ISR_AN_COMPLETE   (1 << 6)

Definition at line 252 of file lan8742_driver.h.

◆ ISR_AN_LP_ACK

#define ISR_AN_LP_ACK   (1 << 3)

Definition at line 255 of file lan8742_driver.h.

◆ ISR_AN_PAGE_RECEIVED

#define ISR_AN_PAGE_RECEIVED   (1 << 1)

Definition at line 257 of file lan8742_driver.h.

◆ ISR_ENERGYON

#define ISR_ENERGYON   (1 << 7)

Definition at line 251 of file lan8742_driver.h.

◆ ISR_LINK_DOWN

#define ISR_LINK_DOWN   (1 << 4)

Definition at line 254 of file lan8742_driver.h.

◆ ISR_PD_FAULT

#define ISR_PD_FAULT   (1 << 2)

Definition at line 256 of file lan8742_driver.h.

◆ ISR_REMOTE_FAULT

#define ISR_REMOTE_FAULT   (1 << 5)

Definition at line 253 of file lan8742_driver.h.

◆ ISR_WOL

#define ISR_WOL   (1 << 8)

Definition at line 250 of file lan8742_driver.h.

◆ LAN8742_PHY_ADDR

#define LAN8742_PHY_ADDR   0

Definition at line 37 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_ANAR

#define LAN8742_PHY_REG_ANAR   0x04

Definition at line 47 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_ANER

#define LAN8742_PHY_REG_ANER   0x06

Definition at line 49 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_ANLPAR

#define LAN8742_PHY_REG_ANLPAR   0x05

Definition at line 48 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_ANNPRR

#define LAN8742_PHY_REG_ANNPRR   0x08

Definition at line 51 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_ANNPTR

#define LAN8742_PHY_REG_ANNPTR   0x07

Definition at line 50 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_BMCR

#define LAN8742_PHY_REG_BMCR   0x00

Definition at line 43 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_BMSR

#define LAN8742_PHY_REG_BMSR   0x01

Definition at line 44 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_CLR

#define LAN8742_PHY_REG_CLR   0x1C

Definition at line 61 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_ENCTR

#define LAN8742_PHY_REG_ENCTR   0x10

Definition at line 54 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_IMR

#define LAN8742_PHY_REG_IMR   0x1E

Definition at line 63 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_ISR

#define LAN8742_PHY_REG_ISR   0x1D

Definition at line 62 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_MCSR

#define LAN8742_PHY_REG_MCSR   0x11

Definition at line 55 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_MMDAADR

#define LAN8742_PHY_REG_MMDAADR   0x0E

Definition at line 53 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_MMDACR

#define LAN8742_PHY_REG_MMDACR   0x0D

Definition at line 52 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_PHYIDR1

#define LAN8742_PHY_REG_PHYIDR1   0x02

Definition at line 45 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_PHYIDR2

#define LAN8742_PHY_REG_PHYIDR2   0x03

Definition at line 46 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_PSCSR

#define LAN8742_PHY_REG_PSCSR   0x1F

Definition at line 64 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_SCSIR

#define LAN8742_PHY_REG_SCSIR   0x1B

Definition at line 60 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_SECR

#define LAN8742_PHY_REG_SECR   0x1A

Definition at line 59 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_SMR

#define LAN8742_PHY_REG_SMR   0x12

Definition at line 56 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_TDRCSR

#define LAN8742_PHY_REG_TDRCSR   0x19

Definition at line 58 of file lan8742_driver.h.

◆ LAN8742_PHY_REG_TDRPDCR

#define LAN8742_PHY_REG_TDRPDCR   0x18

Definition at line 57 of file lan8742_driver.h.

◆ MCSR_ALTINT

#define MCSR_ALTINT   (1 << 6)

Definition at line 191 of file lan8742_driver.h.

◆ MCSR_EDPWRDOWN

#define MCSR_EDPWRDOWN   (1 << 13)

Definition at line 189 of file lan8742_driver.h.

◆ MCSR_ENERGYON

#define MCSR_ENERGYON   (1 << 1)

Definition at line 192 of file lan8742_driver.h.

◆ MCSR_FARLOOPBACK

#define MCSR_FARLOOPBACK   (1 << 9)

Definition at line 190 of file lan8742_driver.h.

◆ MMDACR_DEVAD0

#define MMDACR_DEVAD0   (1 << 0)

Definition at line 176 of file lan8742_driver.h.

◆ MMDACR_DEVAD1

#define MMDACR_DEVAD1   (1 << 1)

Definition at line 175 of file lan8742_driver.h.

◆ MMDACR_DEVAD2

#define MMDACR_DEVAD2   (1 << 2)

Definition at line 174 of file lan8742_driver.h.

◆ MMDACR_DEVAD3

#define MMDACR_DEVAD3   (1 << 3)

Definition at line 173 of file lan8742_driver.h.

◆ MMDACR_DEVAD4

#define MMDACR_DEVAD4   (1 << 4)

Definition at line 172 of file lan8742_driver.h.

◆ MMDACR_FUNCTION0

#define MMDACR_FUNCTION0   (1 << 14)

Definition at line 171 of file lan8742_driver.h.

◆ MMDACR_FUNCTION1

#define MMDACR_FUNCTION1   (1 << 15)

Definition at line 170 of file lan8742_driver.h.

◆ PSCSR_AUTODONE

#define PSCSR_AUTODONE   (1 << 12)

Definition at line 270 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED0

#define PSCSR_HCDSPEED0   (1 << 2)

Definition at line 273 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED1

#define PSCSR_HCDSPEED1   (1 << 3)

Definition at line 272 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED2

#define PSCSR_HCDSPEED2   (1 << 4)

Definition at line 271 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED_100BTX

#define PSCSR_HCDSPEED_100BTX   (2 << 2)

Definition at line 278 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED_100BTX_FD

#define PSCSR_HCDSPEED_100BTX_FD   (6 << 2)

Definition at line 280 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED_10BT

#define PSCSR_HCDSPEED_10BT   (1 << 2)

Definition at line 277 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED_10BT_FD

#define PSCSR_HCDSPEED_10BT_FD   (5 << 2)

Definition at line 279 of file lan8742_driver.h.

◆ PSCSR_HCDSPEED_MASK

#define PSCSR_HCDSPEED_MASK   (7 << 2)

Definition at line 276 of file lan8742_driver.h.

◆ SCSIR_AMDIXCTRL

#define SCSIR_AMDIXCTRL   (1 << 15)

Definition at line 238 of file lan8742_driver.h.

◆ SCSIR_CH_SELECT

#define SCSIR_CH_SELECT   (1 << 13)

Definition at line 239 of file lan8742_driver.h.

◆ SCSIR_SQEOFF

#define SCSIR_SQEOFF   (1 << 11)

Definition at line 240 of file lan8742_driver.h.

◆ SCSIR_XPOL

#define SCSIR_XPOL   (1 << 4)

Definition at line 241 of file lan8742_driver.h.

◆ SMR_MODE0

#define SMR_MODE0   (1 << 5)

Definition at line 197 of file lan8742_driver.h.

◆ SMR_MODE1

#define SMR_MODE1   (1 << 6)

Definition at line 196 of file lan8742_driver.h.

◆ SMR_MODE2

#define SMR_MODE2   (1 << 7)

Definition at line 195 of file lan8742_driver.h.

◆ SMR_PHYAD0

#define SMR_PHYAD0   (1 << 0)

Definition at line 202 of file lan8742_driver.h.

◆ SMR_PHYAD1

#define SMR_PHYAD1   (1 << 1)

Definition at line 201 of file lan8742_driver.h.

◆ SMR_PHYAD2

#define SMR_PHYAD2   (1 << 2)

Definition at line 200 of file lan8742_driver.h.

◆ SMR_PHYAD3

#define SMR_PHYAD3   (1 << 3)

Definition at line 199 of file lan8742_driver.h.

◆ SMR_PHYAD4

#define SMR_PHYAD4   (1 << 4)

Definition at line 198 of file lan8742_driver.h.

◆ TDRCSR_AD_FILTER_EN

#define TDRCSR_AD_FILTER_EN   (1 << 14)

Definition at line 224 of file lan8742_driver.h.

◆ TDRCSR_CH_CABLE_TYPE0

#define TDRCSR_CH_CABLE_TYPE0   (1 << 9)

Definition at line 226 of file lan8742_driver.h.

◆ TDRCSR_CH_CABLE_TYPE1

#define TDRCSR_CH_CABLE_TYPE1   (1 << 10)

Definition at line 225 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH0

#define TDRCSR_CH_LENGTH0   (1 << 0)

Definition at line 235 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH1

#define TDRCSR_CH_LENGTH1   (1 << 1)

Definition at line 234 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH2

#define TDRCSR_CH_LENGTH2   (1 << 2)

Definition at line 233 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH3

#define TDRCSR_CH_LENGTH3   (1 << 3)

Definition at line 232 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH4

#define TDRCSR_CH_LENGTH4   (1 << 4)

Definition at line 231 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH5

#define TDRCSR_CH_LENGTH5   (1 << 5)

Definition at line 230 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH6

#define TDRCSR_CH_LENGTH6   (1 << 6)

Definition at line 229 of file lan8742_driver.h.

◆ TDRCSR_CH_LENGTH7

#define TDRCSR_CH_LENGTH7   (1 << 7)

Definition at line 228 of file lan8742_driver.h.

◆ TDRCSR_CH_STATUS

#define TDRCSR_CH_STATUS   (1 << 8)

Definition at line 227 of file lan8742_driver.h.

◆ TDRCSR_EN

#define TDRCSR_EN   (1 << 15)

Definition at line 223 of file lan8742_driver.h.

◆ TDRPDCR_DELAY_IN

#define TDRPDCR_DELAY_IN   (1 << 15)

Definition at line 205 of file lan8742_driver.h.

◆ TDRPDCR_LINE_BREAK_COUNTER0

#define TDRPDCR_LINE_BREAK_COUNTER0   (1 << 12)

Definition at line 208 of file lan8742_driver.h.

◆ TDRPDCR_LINE_BREAK_COUNTER1

#define TDRPDCR_LINE_BREAK_COUNTER1   (1 << 13)

Definition at line 207 of file lan8742_driver.h.

◆ TDRPDCR_LINE_BREAK_COUNTER2

#define TDRPDCR_LINE_BREAK_COUNTER2   (1 << 14)

Definition at line 206 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_HIGH0

#define TDRPDCR_PATTERN_HIGH0   (1 << 6)

Definition at line 214 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_HIGH1

#define TDRPDCR_PATTERN_HIGH1   (1 << 7)

Definition at line 213 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_HIGH2

#define TDRPDCR_PATTERN_HIGH2   (1 << 8)

Definition at line 212 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_HIGH3

#define TDRPDCR_PATTERN_HIGH3   (1 << 9)

Definition at line 211 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_HIGH4

#define TDRPDCR_PATTERN_HIGH4   (1 << 10)

Definition at line 210 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_HIGH5

#define TDRPDCR_PATTERN_HIGH5   (1 << 11)

Definition at line 209 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_LOW0

#define TDRPDCR_PATTERN_LOW0   (1 << 0)

Definition at line 220 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_LOW1

#define TDRPDCR_PATTERN_LOW1   (1 << 1)

Definition at line 219 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_LOW2

#define TDRPDCR_PATTERN_LOW2   (1 << 2)

Definition at line 218 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_LOW3

#define TDRPDCR_PATTERN_LOW3   (1 << 3)

Definition at line 217 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_LOW4

#define TDRPDCR_PATTERN_LOW4   (1 << 4)

Definition at line 216 of file lan8742_driver.h.

◆ TDRPDCR_PATTERN_LOW5

#define TDRPDCR_PATTERN_LOW5   (1 << 5)

Definition at line 215 of file lan8742_driver.h.

Function Documentation

◆ lan8742DisableIrq()

void lan8742DisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 152 of file lan8742_driver.c.

◆ lan8742DumpPhyReg()

void lan8742DumpPhyReg ( NetInterface interface)

Dump PHY registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface

Definition at line 283 of file lan8742_driver.c.

◆ lan8742EnableIrq()

void lan8742EnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 139 of file lan8742_driver.c.

◆ lan8742EventHandler()

void lan8742EventHandler ( NetInterface interface)

LAN8742 event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 165 of file lan8742_driver.c.

◆ lan8742Init()

error_t lan8742Init ( NetInterface interface)

LAN8742 PHY transceiver initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 58 of file lan8742_driver.c.

◆ lan8742ReadPhyReg()

uint16_t lan8742ReadPhyReg ( NetInterface interface,
uint8_t  address 
)

Read PHY register.

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

Definition at line 263 of file lan8742_driver.c.

◆ lan8742Tick()

void lan8742Tick ( NetInterface interface)

LAN8742 timer handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 101 of file lan8742_driver.c.

◆ lan8742WritePhyReg()

void lan8742WritePhyReg ( 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 241 of file lan8742_driver.c.

Variable Documentation

◆ lan8742PhyDriver

const PhyDriver lan8742PhyDriver

LAN8742 Ethernet PHY driver.

Definition at line 42 of file lan8742_driver.c.