ksz9031_driver.h File Reference

KSZ9031 Gigabit Ethernet PHY transceiver. More...

#include "core/nic.h"

Go to the source code of this file.

Macros

#define KSZ9031_PHY_ADDR   7
 
#define KSZ9031_PHY_REG_BMCR   0x00
 
#define KSZ9031_PHY_REG_BMSR   0x01
 
#define KSZ9031_PHY_REG_PHYIDR1   0x02
 
#define KSZ9031_PHY_REG_PHYIDR2   0x03
 
#define KSZ9031_PHY_REG_ANAR   0x04
 
#define KSZ9031_PHY_REG_ANLPAR   0x05
 
#define KSZ9031_PHY_REG_ANER   0x06
 
#define KSZ9031_PHY_REG_ANNPTR   0x07
 
#define KSZ9031_PHY_REG_LPNPAR   0x08
 
#define KSZ9031_PHY_REG_1000BT_CTRL   0x09
 
#define KSZ9031_PHY_REG_1000BT_STATUS   0x0A
 
#define KSZ9031_PHY_REG_MMD_CTRL   0x0D
 
#define KSZ9031_PHY_REG_MMD_DATA   0x0E
 
#define KSZ9031_PHY_REG_EXT_STATUS   0x0F
 
#define KSZ9031_PHY_REG_RLB   0x11
 
#define KSZ9031_PHY_REG_LINKMDCD   0x12
 
#define KSZ9031_PHY_REG_DPMAPCSS   0x13
 
#define KSZ9031_PHY_REG_RXERCTR   0x15
 
#define KSZ9031_PHY_REG_ICSR   0x1B
 
#define KSZ9031_PHY_REG_AUTOMDI   0x1C
 
#define KSZ9031_PHY_REG_PHYCON   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 BMSR_100BT4   (1 << 15)
 
#define BMSR_100BTX_FD   (1 << 14)
 
#define BMSR_100BTX_HD   (1 << 13)
 
#define BMSR_10BT_FD   (1 << 12)
 
#define BMSR_10BT_HD   (1 << 11)
 
#define BMSR_EXTENDED_STATUS   (1 << 8)
 
#define BMSR_NO_PREAMBLE   (1 << 6)
 
#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_NEXT_PAGE   (1 << 15)
 
#define ANAR_REMOTE_FAULT   (1 << 13)
 
#define ANAR_PAUSE1   (1 << 11)
 
#define ANAR_PAUSE0   (1 << 10)
 
#define ANAR_100BT4   (1 << 9)
 
#define ANAR_100BTX_FD   (1 << 8)
 
#define ANAR_100BTX_HD   (1 << 7)
 
#define ANAR_10BT_FD   (1 << 6)
 
#define ANAR_10BT_HD   (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_NEXT_PAGE   (1 << 15)
 
#define ANLPAR_LP_ACK   (1 << 14)
 
#define ANLPAR_REMOTE_FAULT   (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_HD   (1 << 7)
 
#define ANLPAR_10BT_FD   (1 << 6)
 
#define ANLPAR_10BT_HD   (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_PAR_DET_FAULT   (1 << 4)
 
#define ANER_LP_NEXT_PAGE_ABLE   (1 << 3)
 
#define ANER_NEXT_PAGE_ABLE   (1 << 2)
 
#define ANER_PAGE_RECEIVED   (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 LPNPAR_NEXT_PAGE   (1 << 15)
 
#define LPNPAR_ACK   (1 << 14)
 
#define LPNPAR_MSG_PAGE   (1 << 13)
 
#define LPNPAR_ACK2   (1 << 12)
 
#define LPNPAR_TOGGLE   (1 << 11)
 
#define LPNPAR_MESSAGE10   (1 << 10)
 
#define LPNPAR_MESSAGE9   (1 << 9)
 
#define LPNPAR_MESSAGE8   (1 << 8)
 
#define LPNPAR_MESSAGE7   (1 << 7)
 
#define LPNPAR_MESSAGE6   (1 << 6)
 
#define LPNPAR_MESSAGE5   (1 << 5)
 
#define LPNPAR_MESSAGE4   (1 << 4)
 
#define LPNPAR_MESSAGE3   (1 << 3)
 
#define LPNPAR_MESSAGE2   (1 << 2)
 
#define LPNPAR_MESSAGE1   (1 << 1)
 
#define LPNPAR_MESSAGE0   (1 << 0)
 
#define _1000BT_CTRL_TEST_MODE2   (1 << 15)
 
#define _1000BT_CTRL_TEST_MODE1   (1 << 14)
 
#define _1000BT_CTRL_TEST_MODE0   (1 << 13)
 
#define _1000BT_CTRL_MS_MAN_CONF_EN   (1 << 12)
 
#define _1000BT_CTRL_MS_MAN_CONF_VAL   (1 << 11)
 
#define _1000BT_CTRL_PORT_TYPE   (1 << 10)
 
#define _1000BT_CTRL_1000BT_FD   (1 << 9)
 
#define _1000BT_CTRL_1000BT_HD   (1 << 8)
 
#define _1000BT_STATUS_MS_CONF_FAULT   (1 << 15)
 
#define _1000BT_STATUS_MS_CONF_RES   (1 << 14)
 
#define _1000BT_STATUS_LOC_REC_STATUS   (1 << 13)
 
#define _1000BT_STATUS_REM_REC_STATUS   (1 << 12)
 
#define _1000BT_STATUS_LP_1000BT_FD   (1 << 11)
 
#define _1000BT_STATUS_LP_1000BT_HD   (1 << 10)
 
#define _1000BT_STATUS_IDLE_ERR_CTR7   (1 << 7)
 
#define _1000BT_STATUS_IDLE_ERR_CTR6   (1 << 6)
 
#define _1000BT_STATUS_IDLE_ERR_CTR5   (1 << 5)
 
#define _1000BT_STATUS_IDLE_ERR_CTR4   (1 << 4)
 
#define _1000BT_STATUS_IDLE_ERR_CTR3   (1 << 3)
 
#define _1000BT_STATUS_IDLE_ERR_CTR2   (1 << 2)
 
#define _1000BT_STATUS_IDLE_ERR_CTR1   (1 << 1)
 
#define _1000BT_STATUS_IDLE_ERR_CTR0   (1 << 0)
 
#define MMD_CTRL_DEVICE_OP_MODE1   (1 << 15)
 
#define MMD_CTRL_DEVICE_OP_MODE0   (1 << 14)
 
#define MMD_CTRL_DEVICE_ADDR4   (1 << 4)
 
#define MMD_CTRL_DEVICE_ADDR3   (1 << 3)
 
#define MMD_CTRL_DEVICE_ADDR2   (1 << 2)
 
#define MMD_CTRL_DEVICE_ADDR1   (1 << 1)
 
#define MMD_CTRL_DEVICE_ADDR0   (1 << 0)
 
#define EXT_STATUS_1000BX_FD   (1 << 15)
 
#define EXT_STATUS_1000BX_HD   (1 << 14)
 
#define EXT_STATUS_1000BT_FD   (1 << 13)
 
#define EXT_STATUS_1000BT_HD   (1 << 12)
 
#define RLB_REMOTE_LOOPBACK   (1 << 8)
 
#define LINKMDCD_DIAG_EN   (1 << 15)
 
#define LINKMDCD_DIAG_TEST_PAIR1   (1 << 13)
 
#define LINKMDCD_DIAG_TEST_PAIR0   (1 << 12)
 
#define LINKMDCD_FAULT_STATUS1   (1 << 9)
 
#define LINKMDCD_FAULT_STATUS0   (1 << 8)
 
#define LINKMDCD_FAULT_DATA7   (1 << 7)
 
#define LINKMDCD_FAULT_DATA6   (1 << 6)
 
#define LINKMDCD_FAULT_DATA5   (1 << 5)
 
#define LINKMDCD_FAULT_DATA4   (1 << 4)
 
#define LINKMDCD_FAULT_DATA3   (1 << 3)
 
#define LINKMDCD_FAULT_DATA2   (1 << 2)
 
#define LINKMDCD_FAULT_DATA1   (1 << 1)
 
#define LINKMDCD_FAULT_DATA0   (1 << 0)
 
#define DPMAPCSS_1000BT_LINK_STATUS   (1 << 2)
 
#define DPMAPCSS_100BTX_LINK_STATUS   (1 << 1)
 
#define ICSR_JABBER_IE   (1 << 15)
 
#define ICSR_RECEIVE_ERROR_IE   (1 << 14)
 
#define ICSR_PAGE_RECEIVED_IE   (1 << 13)
 
#define ICSR_PAR_DET_FAULT_IE   (1 << 12)
 
#define ICSR_LP_ACK_IE   (1 << 11)
 
#define ICSR_LINK_DOWN_IE   (1 << 10)
 
#define ICSR_REMOTE_FAULT_IE   (1 << 9)
 
#define ICSR_LINK_UP_IE   (1 << 8)
 
#define ICSR_JABBER_IF   (1 << 7)
 
#define ICSR_RECEIVE_ERROR_IF   (1 << 6)
 
#define ICSR_PAGE_RECEIVED_IF   (1 << 5)
 
#define ICSR_PAR_DET_FAULT_IF   (1 << 4)
 
#define ICSR_LP_ACK_IF   (1 << 3)
 
#define ICSR_LINK_DOWN_IF   (1 << 2)
 
#define ICSR_REMOTE_FAULT_IF   (1 << 1)
 
#define ICSR_LINK_UP_IF   (1 << 0)
 
#define AUTOMDI_MDI_SEL   (1 << 7)
 
#define AUTOMDI_SWAP_OFF   (1 << 6)
 
#define PHYCON_INT_LEVEL   (1 << 14)
 
#define PHYCON_JABBER_EN   (1 << 9)
 
#define PHYCON_SPEED_1000BT   (1 << 6)
 
#define PHYCON_SPEED_100BTX   (1 << 5)
 
#define PHYCON_SPEED_10BT   (1 << 4)
 
#define PHYCON_DUPLEX_STATUS   (1 << 3)
 
#define PHYCON_1000BT_MS_STATUS   (1 << 2)
 
#define PHYCON_LINK_STATUS_CHECK_FAIL   (1 << 0)
 

Functions

error_t ksz9031Init (NetInterface *interface)
 KSZ9031 PHY transceiver initialization. More...
 
void ksz9031Tick (NetInterface *interface)
 KSZ9031 timer handler. More...
 
void ksz9031EnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void ksz9031DisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
void ksz9031EventHandler (NetInterface *interface)
 KSZ9031 event handler. More...
 
void ksz9031WritePhyReg (NetInterface *interface, uint8_t address, uint16_t data)
 Write PHY register. More...
 
uint16_t ksz9031ReadPhyReg (NetInterface *interface, uint8_t address)
 Read PHY register. More...
 
void ksz9031DumpPhyReg (NetInterface *interface)
 Dump PHY registers for debugging purpose. More...
 

Variables

const PhyDriver ksz9031PhyDriver
 KSZ9031 Ethernet PHY driver. More...
 

Detailed Description

KSZ9031 Gigabit 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 ksz9031_driver.h.

Macro Definition Documentation

◆ _1000BT_CTRL_1000BT_FD

#define _1000BT_CTRL_1000BT_FD   (1 << 9)

Definition at line 172 of file ksz9031_driver.h.

◆ _1000BT_CTRL_1000BT_HD

#define _1000BT_CTRL_1000BT_HD   (1 << 8)

Definition at line 173 of file ksz9031_driver.h.

◆ _1000BT_CTRL_MS_MAN_CONF_EN

#define _1000BT_CTRL_MS_MAN_CONF_EN   (1 << 12)

Definition at line 169 of file ksz9031_driver.h.

◆ _1000BT_CTRL_MS_MAN_CONF_VAL

#define _1000BT_CTRL_MS_MAN_CONF_VAL   (1 << 11)

Definition at line 170 of file ksz9031_driver.h.

◆ _1000BT_CTRL_PORT_TYPE

#define _1000BT_CTRL_PORT_TYPE   (1 << 10)

Definition at line 171 of file ksz9031_driver.h.

◆ _1000BT_CTRL_TEST_MODE0

#define _1000BT_CTRL_TEST_MODE0   (1 << 13)

Definition at line 168 of file ksz9031_driver.h.

◆ _1000BT_CTRL_TEST_MODE1

#define _1000BT_CTRL_TEST_MODE1   (1 << 14)

Definition at line 167 of file ksz9031_driver.h.

◆ _1000BT_CTRL_TEST_MODE2

#define _1000BT_CTRL_TEST_MODE2   (1 << 15)

Definition at line 166 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR0

#define _1000BT_STATUS_IDLE_ERR_CTR0   (1 << 0)

Definition at line 189 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR1

#define _1000BT_STATUS_IDLE_ERR_CTR1   (1 << 1)

Definition at line 188 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR2

#define _1000BT_STATUS_IDLE_ERR_CTR2   (1 << 2)

Definition at line 187 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR3

#define _1000BT_STATUS_IDLE_ERR_CTR3   (1 << 3)

Definition at line 186 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR4

#define _1000BT_STATUS_IDLE_ERR_CTR4   (1 << 4)

Definition at line 185 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR5

#define _1000BT_STATUS_IDLE_ERR_CTR5   (1 << 5)

Definition at line 184 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR6

#define _1000BT_STATUS_IDLE_ERR_CTR6   (1 << 6)

Definition at line 183 of file ksz9031_driver.h.

◆ _1000BT_STATUS_IDLE_ERR_CTR7

#define _1000BT_STATUS_IDLE_ERR_CTR7   (1 << 7)

Definition at line 182 of file ksz9031_driver.h.

◆ _1000BT_STATUS_LOC_REC_STATUS

#define _1000BT_STATUS_LOC_REC_STATUS   (1 << 13)

Definition at line 178 of file ksz9031_driver.h.

◆ _1000BT_STATUS_LP_1000BT_FD

#define _1000BT_STATUS_LP_1000BT_FD   (1 << 11)

Definition at line 180 of file ksz9031_driver.h.

◆ _1000BT_STATUS_LP_1000BT_HD

#define _1000BT_STATUS_LP_1000BT_HD   (1 << 10)

Definition at line 181 of file ksz9031_driver.h.

◆ _1000BT_STATUS_MS_CONF_FAULT

#define _1000BT_STATUS_MS_CONF_FAULT   (1 << 15)

Definition at line 176 of file ksz9031_driver.h.

◆ _1000BT_STATUS_MS_CONF_RES

#define _1000BT_STATUS_MS_CONF_RES   (1 << 14)

Definition at line 177 of file ksz9031_driver.h.

◆ _1000BT_STATUS_REM_REC_STATUS

#define _1000BT_STATUS_REM_REC_STATUS   (1 << 12)

Definition at line 179 of file ksz9031_driver.h.

◆ ANAR_100BT4

#define ANAR_100BT4   (1 << 9)

Definition at line 95 of file ksz9031_driver.h.

◆ ANAR_100BTX_FD

#define ANAR_100BTX_FD   (1 << 8)

Definition at line 96 of file ksz9031_driver.h.

◆ ANAR_100BTX_HD

#define ANAR_100BTX_HD   (1 << 7)

Definition at line 97 of file ksz9031_driver.h.

◆ ANAR_10BT_FD

#define ANAR_10BT_FD   (1 << 6)

Definition at line 98 of file ksz9031_driver.h.

◆ ANAR_10BT_HD

#define ANAR_10BT_HD   (1 << 5)

Definition at line 99 of file ksz9031_driver.h.

◆ ANAR_NEXT_PAGE

#define ANAR_NEXT_PAGE   (1 << 15)

Definition at line 91 of file ksz9031_driver.h.

◆ ANAR_PAUSE0

#define ANAR_PAUSE0   (1 << 10)

Definition at line 94 of file ksz9031_driver.h.

◆ ANAR_PAUSE1

#define ANAR_PAUSE1   (1 << 11)

Definition at line 93 of file ksz9031_driver.h.

◆ ANAR_REMOTE_FAULT

#define ANAR_REMOTE_FAULT   (1 << 13)

Definition at line 92 of file ksz9031_driver.h.

◆ ANAR_SELECTOR0

#define ANAR_SELECTOR0   (1 << 0)

Definition at line 104 of file ksz9031_driver.h.

◆ ANAR_SELECTOR1

#define ANAR_SELECTOR1   (1 << 1)

Definition at line 103 of file ksz9031_driver.h.

◆ ANAR_SELECTOR2

#define ANAR_SELECTOR2   (1 << 2)

Definition at line 102 of file ksz9031_driver.h.

◆ ANAR_SELECTOR3

#define ANAR_SELECTOR3   (1 << 3)

Definition at line 101 of file ksz9031_driver.h.

◆ ANAR_SELECTOR4

#define ANAR_SELECTOR4   (1 << 4)

Definition at line 100 of file ksz9031_driver.h.

◆ ANER_LP_AN_ABLE

#define ANER_LP_AN_ABLE   (1 << 0)

Definition at line 128 of file ksz9031_driver.h.

◆ ANER_LP_NEXT_PAGE_ABLE

#define ANER_LP_NEXT_PAGE_ABLE   (1 << 3)

Definition at line 125 of file ksz9031_driver.h.

◆ ANER_NEXT_PAGE_ABLE

#define ANER_NEXT_PAGE_ABLE   (1 << 2)

Definition at line 126 of file ksz9031_driver.h.

◆ ANER_PAGE_RECEIVED

#define ANER_PAGE_RECEIVED   (1 << 1)

Definition at line 127 of file ksz9031_driver.h.

◆ ANER_PAR_DET_FAULT

#define ANER_PAR_DET_FAULT   (1 << 4)

Definition at line 124 of file ksz9031_driver.h.

◆ ANLPAR_100BT4

#define ANLPAR_100BT4   (1 << 9)

Definition at line 112 of file ksz9031_driver.h.

◆ ANLPAR_100BTX_FD

#define ANLPAR_100BTX_FD   (1 << 8)

Definition at line 113 of file ksz9031_driver.h.

◆ ANLPAR_100BTX_HD

#define ANLPAR_100BTX_HD   (1 << 7)

Definition at line 114 of file ksz9031_driver.h.

◆ ANLPAR_10BT_FD

#define ANLPAR_10BT_FD   (1 << 6)

Definition at line 115 of file ksz9031_driver.h.

◆ ANLPAR_10BT_HD

#define ANLPAR_10BT_HD   (1 << 5)

Definition at line 116 of file ksz9031_driver.h.

◆ ANLPAR_LP_ACK

#define ANLPAR_LP_ACK   (1 << 14)

Definition at line 108 of file ksz9031_driver.h.

◆ ANLPAR_NEXT_PAGE

#define ANLPAR_NEXT_PAGE   (1 << 15)

Definition at line 107 of file ksz9031_driver.h.

◆ ANLPAR_PAUSE0

#define ANLPAR_PAUSE0   (1 << 10)

Definition at line 111 of file ksz9031_driver.h.

◆ ANLPAR_PAUSE1

#define ANLPAR_PAUSE1   (1 << 11)

Definition at line 110 of file ksz9031_driver.h.

◆ ANLPAR_REMOTE_FAULT

#define ANLPAR_REMOTE_FAULT   (1 << 13)

Definition at line 109 of file ksz9031_driver.h.

◆ ANLPAR_SELECTOR0

#define ANLPAR_SELECTOR0   (1 << 0)

Definition at line 121 of file ksz9031_driver.h.

◆ ANLPAR_SELECTOR1

#define ANLPAR_SELECTOR1   (1 << 1)

Definition at line 120 of file ksz9031_driver.h.

◆ ANLPAR_SELECTOR2

#define ANLPAR_SELECTOR2   (1 << 2)

Definition at line 119 of file ksz9031_driver.h.

◆ ANLPAR_SELECTOR3

#define ANLPAR_SELECTOR3   (1 << 3)

Definition at line 118 of file ksz9031_driver.h.

◆ ANLPAR_SELECTOR4

#define ANLPAR_SELECTOR4   (1 << 4)

Definition at line 117 of file ksz9031_driver.h.

◆ ANNPTR_ACK2

#define ANNPTR_ACK2   (1 << 12)

Definition at line 133 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE0

#define ANNPTR_MESSAGE0   (1 << 0)

Definition at line 145 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE1

#define ANNPTR_MESSAGE1   (1 << 1)

Definition at line 144 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE10

#define ANNPTR_MESSAGE10   (1 << 10)

Definition at line 135 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE2

#define ANNPTR_MESSAGE2   (1 << 2)

Definition at line 143 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE3

#define ANNPTR_MESSAGE3   (1 << 3)

Definition at line 142 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE4

#define ANNPTR_MESSAGE4   (1 << 4)

Definition at line 141 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE5

#define ANNPTR_MESSAGE5   (1 << 5)

Definition at line 140 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE6

#define ANNPTR_MESSAGE6   (1 << 6)

Definition at line 139 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE7

#define ANNPTR_MESSAGE7   (1 << 7)

Definition at line 138 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE8

#define ANNPTR_MESSAGE8   (1 << 8)

Definition at line 137 of file ksz9031_driver.h.

◆ ANNPTR_MESSAGE9

#define ANNPTR_MESSAGE9   (1 << 9)

Definition at line 136 of file ksz9031_driver.h.

◆ ANNPTR_MSG_PAGE

#define ANNPTR_MSG_PAGE   (1 << 13)

Definition at line 132 of file ksz9031_driver.h.

◆ ANNPTR_NEXT_PAGE

#define ANNPTR_NEXT_PAGE   (1 << 15)

Definition at line 131 of file ksz9031_driver.h.

◆ ANNPTR_TOGGLE

#define ANNPTR_TOGGLE   (1 << 11)

Definition at line 134 of file ksz9031_driver.h.

◆ AUTOMDI_MDI_SEL

#define AUTOMDI_MDI_SEL   (1 << 7)

Definition at line 247 of file ksz9031_driver.h.

◆ AUTOMDI_SWAP_OFF

#define AUTOMDI_SWAP_OFF   (1 << 6)

Definition at line 248 of file ksz9031_driver.h.

◆ BMCR_AN_EN

#define BMCR_AN_EN   (1 << 12)

Definition at line 69 of file ksz9031_driver.h.

◆ BMCR_DUPLEX_MODE

#define BMCR_DUPLEX_MODE   (1 << 8)

Definition at line 73 of file ksz9031_driver.h.

◆ BMCR_ISOLATE

#define BMCR_ISOLATE   (1 << 10)

Definition at line 71 of file ksz9031_driver.h.

◆ BMCR_LOOPBACK

#define BMCR_LOOPBACK   (1 << 14)

Definition at line 67 of file ksz9031_driver.h.

◆ BMCR_POWER_DOWN

#define BMCR_POWER_DOWN   (1 << 11)

Definition at line 70 of file ksz9031_driver.h.

◆ BMCR_RESET

#define BMCR_RESET   (1 << 15)

Definition at line 66 of file ksz9031_driver.h.

◆ BMCR_RESTART_AN

#define BMCR_RESTART_AN   (1 << 9)

Definition at line 72 of file ksz9031_driver.h.

◆ BMCR_SPEED_SEL

#define BMCR_SPEED_SEL   (1 << 13)

Definition at line 68 of file ksz9031_driver.h.

◆ BMSR_100BT4

#define BMSR_100BT4   (1 << 15)

Definition at line 76 of file ksz9031_driver.h.

◆ BMSR_100BTX_FD

#define BMSR_100BTX_FD   (1 << 14)

Definition at line 77 of file ksz9031_driver.h.

◆ BMSR_100BTX_HD

#define BMSR_100BTX_HD   (1 << 13)

Definition at line 78 of file ksz9031_driver.h.

◆ BMSR_10BT_FD

#define BMSR_10BT_FD   (1 << 12)

Definition at line 79 of file ksz9031_driver.h.

◆ BMSR_10BT_HD

#define BMSR_10BT_HD   (1 << 11)

Definition at line 80 of file ksz9031_driver.h.

◆ BMSR_AN_ABLE

#define BMSR_AN_ABLE   (1 << 3)

Definition at line 85 of file ksz9031_driver.h.

◆ BMSR_AN_COMPLETE

#define BMSR_AN_COMPLETE   (1 << 5)

Definition at line 83 of file ksz9031_driver.h.

◆ BMSR_EXTENDED_CAP

#define BMSR_EXTENDED_CAP   (1 << 0)

Definition at line 88 of file ksz9031_driver.h.

◆ BMSR_EXTENDED_STATUS

#define BMSR_EXTENDED_STATUS   (1 << 8)

Definition at line 81 of file ksz9031_driver.h.

◆ BMSR_JABBER_DETECT

#define BMSR_JABBER_DETECT   (1 << 1)

Definition at line 87 of file ksz9031_driver.h.

◆ BMSR_LINK_STATUS

#define BMSR_LINK_STATUS   (1 << 2)

Definition at line 86 of file ksz9031_driver.h.

◆ BMSR_NO_PREAMBLE

#define BMSR_NO_PREAMBLE   (1 << 6)

Definition at line 82 of file ksz9031_driver.h.

◆ BMSR_REMOTE_FAULT

#define BMSR_REMOTE_FAULT   (1 << 4)

Definition at line 84 of file ksz9031_driver.h.

◆ DPMAPCSS_1000BT_LINK_STATUS

#define DPMAPCSS_1000BT_LINK_STATUS   (1 << 2)

Definition at line 225 of file ksz9031_driver.h.

◆ DPMAPCSS_100BTX_LINK_STATUS

#define DPMAPCSS_100BTX_LINK_STATUS   (1 << 1)

Definition at line 226 of file ksz9031_driver.h.

◆ EXT_STATUS_1000BT_FD

#define EXT_STATUS_1000BT_FD   (1 << 13)

Definition at line 203 of file ksz9031_driver.h.

◆ EXT_STATUS_1000BT_HD

#define EXT_STATUS_1000BT_HD   (1 << 12)

Definition at line 204 of file ksz9031_driver.h.

◆ EXT_STATUS_1000BX_FD

#define EXT_STATUS_1000BX_FD   (1 << 15)

Definition at line 201 of file ksz9031_driver.h.

◆ EXT_STATUS_1000BX_HD

#define EXT_STATUS_1000BX_HD   (1 << 14)

Definition at line 202 of file ksz9031_driver.h.

◆ ICSR_JABBER_IE

#define ICSR_JABBER_IE   (1 << 15)

Definition at line 229 of file ksz9031_driver.h.

◆ ICSR_JABBER_IF

#define ICSR_JABBER_IF   (1 << 7)

Definition at line 237 of file ksz9031_driver.h.

◆ ICSR_LINK_DOWN_IE

#define ICSR_LINK_DOWN_IE   (1 << 10)

Definition at line 234 of file ksz9031_driver.h.

◆ ICSR_LINK_DOWN_IF

#define ICSR_LINK_DOWN_IF   (1 << 2)

Definition at line 242 of file ksz9031_driver.h.

◆ ICSR_LINK_UP_IE

#define ICSR_LINK_UP_IE   (1 << 8)

Definition at line 236 of file ksz9031_driver.h.

◆ ICSR_LINK_UP_IF

#define ICSR_LINK_UP_IF   (1 << 0)

Definition at line 244 of file ksz9031_driver.h.

◆ ICSR_LP_ACK_IE

#define ICSR_LP_ACK_IE   (1 << 11)

Definition at line 233 of file ksz9031_driver.h.

◆ ICSR_LP_ACK_IF

#define ICSR_LP_ACK_IF   (1 << 3)

Definition at line 241 of file ksz9031_driver.h.

◆ ICSR_PAGE_RECEIVED_IE

#define ICSR_PAGE_RECEIVED_IE   (1 << 13)

Definition at line 231 of file ksz9031_driver.h.

◆ ICSR_PAGE_RECEIVED_IF

#define ICSR_PAGE_RECEIVED_IF   (1 << 5)

Definition at line 239 of file ksz9031_driver.h.

◆ ICSR_PAR_DET_FAULT_IE

#define ICSR_PAR_DET_FAULT_IE   (1 << 12)

Definition at line 232 of file ksz9031_driver.h.

◆ ICSR_PAR_DET_FAULT_IF

#define ICSR_PAR_DET_FAULT_IF   (1 << 4)

Definition at line 240 of file ksz9031_driver.h.

◆ ICSR_RECEIVE_ERROR_IE

#define ICSR_RECEIVE_ERROR_IE   (1 << 14)

Definition at line 230 of file ksz9031_driver.h.

◆ ICSR_RECEIVE_ERROR_IF

#define ICSR_RECEIVE_ERROR_IF   (1 << 6)

Definition at line 238 of file ksz9031_driver.h.

◆ ICSR_REMOTE_FAULT_IE

#define ICSR_REMOTE_FAULT_IE   (1 << 9)

Definition at line 235 of file ksz9031_driver.h.

◆ ICSR_REMOTE_FAULT_IF

#define ICSR_REMOTE_FAULT_IF   (1 << 1)

Definition at line 243 of file ksz9031_driver.h.

◆ KSZ9031_PHY_ADDR

#define KSZ9031_PHY_ADDR   7

Definition at line 37 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_1000BT_CTRL

#define KSZ9031_PHY_REG_1000BT_CTRL   0x09

Definition at line 52 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_1000BT_STATUS

#define KSZ9031_PHY_REG_1000BT_STATUS   0x0A

Definition at line 53 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_ANAR

#define KSZ9031_PHY_REG_ANAR   0x04

Definition at line 47 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_ANER

#define KSZ9031_PHY_REG_ANER   0x06

Definition at line 49 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_ANLPAR

#define KSZ9031_PHY_REG_ANLPAR   0x05

Definition at line 48 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_ANNPTR

#define KSZ9031_PHY_REG_ANNPTR   0x07

Definition at line 50 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_AUTOMDI

#define KSZ9031_PHY_REG_AUTOMDI   0x1C

Definition at line 62 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_BMCR

#define KSZ9031_PHY_REG_BMCR   0x00

Definition at line 43 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_BMSR

#define KSZ9031_PHY_REG_BMSR   0x01

Definition at line 44 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_DPMAPCSS

#define KSZ9031_PHY_REG_DPMAPCSS   0x13

Definition at line 59 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_EXT_STATUS

#define KSZ9031_PHY_REG_EXT_STATUS   0x0F

Definition at line 56 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_ICSR

#define KSZ9031_PHY_REG_ICSR   0x1B

Definition at line 61 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_LINKMDCD

#define KSZ9031_PHY_REG_LINKMDCD   0x12

Definition at line 58 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_LPNPAR

#define KSZ9031_PHY_REG_LPNPAR   0x08

Definition at line 51 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_MMD_CTRL

#define KSZ9031_PHY_REG_MMD_CTRL   0x0D

Definition at line 54 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_MMD_DATA

#define KSZ9031_PHY_REG_MMD_DATA   0x0E

Definition at line 55 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_PHYCON

#define KSZ9031_PHY_REG_PHYCON   0x1F

Definition at line 63 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_PHYIDR1

#define KSZ9031_PHY_REG_PHYIDR1   0x02

Definition at line 45 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_PHYIDR2

#define KSZ9031_PHY_REG_PHYIDR2   0x03

Definition at line 46 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_RLB

#define KSZ9031_PHY_REG_RLB   0x11

Definition at line 57 of file ksz9031_driver.h.

◆ KSZ9031_PHY_REG_RXERCTR

#define KSZ9031_PHY_REG_RXERCTR   0x15

Definition at line 60 of file ksz9031_driver.h.

◆ LINKMDCD_DIAG_EN

#define LINKMDCD_DIAG_EN   (1 << 15)

Definition at line 210 of file ksz9031_driver.h.

◆ LINKMDCD_DIAG_TEST_PAIR0

#define LINKMDCD_DIAG_TEST_PAIR0   (1 << 12)

Definition at line 212 of file ksz9031_driver.h.

◆ LINKMDCD_DIAG_TEST_PAIR1

#define LINKMDCD_DIAG_TEST_PAIR1   (1 << 13)

Definition at line 211 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA0

#define LINKMDCD_FAULT_DATA0   (1 << 0)

Definition at line 222 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA1

#define LINKMDCD_FAULT_DATA1   (1 << 1)

Definition at line 221 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA2

#define LINKMDCD_FAULT_DATA2   (1 << 2)

Definition at line 220 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA3

#define LINKMDCD_FAULT_DATA3   (1 << 3)

Definition at line 219 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA4

#define LINKMDCD_FAULT_DATA4   (1 << 4)

Definition at line 218 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA5

#define LINKMDCD_FAULT_DATA5   (1 << 5)

Definition at line 217 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA6

#define LINKMDCD_FAULT_DATA6   (1 << 6)

Definition at line 216 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_DATA7

#define LINKMDCD_FAULT_DATA7   (1 << 7)

Definition at line 215 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_STATUS0

#define LINKMDCD_FAULT_STATUS0   (1 << 8)

Definition at line 214 of file ksz9031_driver.h.

◆ LINKMDCD_FAULT_STATUS1

#define LINKMDCD_FAULT_STATUS1   (1 << 9)

Definition at line 213 of file ksz9031_driver.h.

◆ LPNPAR_ACK

#define LPNPAR_ACK   (1 << 14)

Definition at line 149 of file ksz9031_driver.h.

◆ LPNPAR_ACK2

#define LPNPAR_ACK2   (1 << 12)

Definition at line 151 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE0

#define LPNPAR_MESSAGE0   (1 << 0)

Definition at line 163 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE1

#define LPNPAR_MESSAGE1   (1 << 1)

Definition at line 162 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE10

#define LPNPAR_MESSAGE10   (1 << 10)

Definition at line 153 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE2

#define LPNPAR_MESSAGE2   (1 << 2)

Definition at line 161 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE3

#define LPNPAR_MESSAGE3   (1 << 3)

Definition at line 160 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE4

#define LPNPAR_MESSAGE4   (1 << 4)

Definition at line 159 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE5

#define LPNPAR_MESSAGE5   (1 << 5)

Definition at line 158 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE6

#define LPNPAR_MESSAGE6   (1 << 6)

Definition at line 157 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE7

#define LPNPAR_MESSAGE7   (1 << 7)

Definition at line 156 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE8

#define LPNPAR_MESSAGE8   (1 << 8)

Definition at line 155 of file ksz9031_driver.h.

◆ LPNPAR_MESSAGE9

#define LPNPAR_MESSAGE9   (1 << 9)

Definition at line 154 of file ksz9031_driver.h.

◆ LPNPAR_MSG_PAGE

#define LPNPAR_MSG_PAGE   (1 << 13)

Definition at line 150 of file ksz9031_driver.h.

◆ LPNPAR_NEXT_PAGE

#define LPNPAR_NEXT_PAGE   (1 << 15)

Definition at line 148 of file ksz9031_driver.h.

◆ LPNPAR_TOGGLE

#define LPNPAR_TOGGLE   (1 << 11)

Definition at line 152 of file ksz9031_driver.h.

◆ MMD_CTRL_DEVICE_ADDR0

#define MMD_CTRL_DEVICE_ADDR0   (1 << 0)

Definition at line 198 of file ksz9031_driver.h.

◆ MMD_CTRL_DEVICE_ADDR1

#define MMD_CTRL_DEVICE_ADDR1   (1 << 1)

Definition at line 197 of file ksz9031_driver.h.

◆ MMD_CTRL_DEVICE_ADDR2

#define MMD_CTRL_DEVICE_ADDR2   (1 << 2)

Definition at line 196 of file ksz9031_driver.h.

◆ MMD_CTRL_DEVICE_ADDR3

#define MMD_CTRL_DEVICE_ADDR3   (1 << 3)

Definition at line 195 of file ksz9031_driver.h.

◆ MMD_CTRL_DEVICE_ADDR4

#define MMD_CTRL_DEVICE_ADDR4   (1 << 4)

Definition at line 194 of file ksz9031_driver.h.

◆ MMD_CTRL_DEVICE_OP_MODE0

#define MMD_CTRL_DEVICE_OP_MODE0   (1 << 14)

Definition at line 193 of file ksz9031_driver.h.

◆ MMD_CTRL_DEVICE_OP_MODE1

#define MMD_CTRL_DEVICE_OP_MODE1   (1 << 15)

Definition at line 192 of file ksz9031_driver.h.

◆ PHYCON_1000BT_MS_STATUS

#define PHYCON_1000BT_MS_STATUS   (1 << 2)

Definition at line 257 of file ksz9031_driver.h.

◆ PHYCON_DUPLEX_STATUS

#define PHYCON_DUPLEX_STATUS   (1 << 3)

Definition at line 256 of file ksz9031_driver.h.

◆ PHYCON_INT_LEVEL

#define PHYCON_INT_LEVEL   (1 << 14)

Definition at line 251 of file ksz9031_driver.h.

◆ PHYCON_JABBER_EN

#define PHYCON_JABBER_EN   (1 << 9)

Definition at line 252 of file ksz9031_driver.h.

◆ PHYCON_LINK_STATUS_CHECK_FAIL

#define PHYCON_LINK_STATUS_CHECK_FAIL   (1 << 0)

Definition at line 258 of file ksz9031_driver.h.

◆ PHYCON_SPEED_1000BT

#define PHYCON_SPEED_1000BT   (1 << 6)

Definition at line 253 of file ksz9031_driver.h.

◆ PHYCON_SPEED_100BTX

#define PHYCON_SPEED_100BTX   (1 << 5)

Definition at line 254 of file ksz9031_driver.h.

◆ PHYCON_SPEED_10BT

#define PHYCON_SPEED_10BT   (1 << 4)

Definition at line 255 of file ksz9031_driver.h.

◆ RLB_REMOTE_LOOPBACK

#define RLB_REMOTE_LOOPBACK   (1 << 8)

Definition at line 207 of file ksz9031_driver.h.

Function Documentation

◆ ksz9031DisableIrq()

void ksz9031DisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 144 of file ksz9031_driver.c.

◆ ksz9031DumpPhyReg()

void ksz9031DumpPhyReg ( NetInterface interface)

Dump PHY registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface

Definition at line 273 of file ksz9031_driver.c.

◆ ksz9031EnableIrq()

void ksz9031EnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 131 of file ksz9031_driver.c.

◆ ksz9031EventHandler()

void ksz9031EventHandler ( NetInterface interface)

KSZ9031 event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 157 of file ksz9031_driver.c.

◆ ksz9031Init()

error_t ksz9031Init ( NetInterface interface)

KSZ9031 PHY transceiver initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 58 of file ksz9031_driver.c.

◆ ksz9031ReadPhyReg()

uint16_t ksz9031ReadPhyReg ( NetInterface interface,
uint8_t  address 
)

Read PHY register.

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

Definition at line 253 of file ksz9031_driver.c.

◆ ksz9031Tick()

void ksz9031Tick ( NetInterface interface)

KSZ9031 timer handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 93 of file ksz9031_driver.c.

◆ ksz9031WritePhyReg()

void ksz9031WritePhyReg ( 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 231 of file ksz9031_driver.c.

Variable Documentation

◆ ksz9031PhyDriver

const PhyDriver ksz9031PhyDriver

KSZ9031 Ethernet PHY driver.

Definition at line 42 of file ksz9031_driver.c.