ksz8463_driver.h File Reference

KSZ8463 3-port Ethernet switch. More...

#include "core/nic.h"

Go to the source code of this file.


#define KSZ8463_PORT1   1
#define KSZ8463_PORT2   2
#define KSZ8463_SPI_CMD_READ   0x0000
#define KSZ8463_SPI_CMD_WRITE   0x8000
#define KSZ8463_SPI_CMD_ADDR   0x7FC0
#define KSZ8463_SPI_CMD_B3   0x0020
#define KSZ8463_SPI_CMD_B2   0x0010
#define KSZ8463_SPI_CMD_B1   0x0008
#define KSZ8463_SPI_CMD_B0   0x0004
#define KSZ8463_BMCR   0x00
#define KSZ8463_BMSR   0x01
#define KSZ8463_PHYID1   0x02
#define KSZ8463_PHYID2   0x03
#define KSZ8463_ANAR   0x04
#define KSZ8463_ANLPAR   0x05
#define KSZ8463_LINKMD   0x1D
#define KSZ8463_PHYSCS   0x1F
#define KSZ8463_CIDER   0x00
#define KSZ8463_SGCR1   0x02
#define KSZ8463_SGCR2   0x04
#define KSZ8463_SGCR3   0x06
#define KSZ8463_SGCR6   0x0C
#define KSZ8463_SGCR7   0x0E
#define KSZ8463_P1CR1   0x6C
#define KSZ8463_P1CR2   0x6E
#define KSZ8463_P1SR   0x80
#define KSZ8463_P2CR1   0x84
#define KSZ8463_P2CR2   0x86
#define KSZ8463_P2SR   0x98
#define KSZ8463_P3CR1   0x9C
#define KSZ8463_P3CR2   0x9E
#define KSZ8463_SGCR8   0xAC
#define KSZ8463_PnCR1(port)   (0x54 + ((port) * 0x18))
#define KSZ8463_PnCR2(port)   (0x56 + ((port) * 0x18))
#define KSZ8463_PnSR(port)   (0x68 + ((port) * 0x18))
#define KSZ8463_BMCR_LOOPBACK   0x4000
#define KSZ8463_BMCR_FORCE_100   0x2000
#define KSZ8463_BMCR_AN_EN   0x1000
#define KSZ8463_BMCR_POWER_DOWN   0x0800
#define KSZ8463_BMCR_ISOLATE   0x0400
#define KSZ8463_BMCR_RESTART_AN   0x0200
#define KSZ8463_BMCR_FORCE_FULL_DUPLEX   0x0100
#define KSZ8463_BMCR_COL_TEST   0x0080
#define KSZ8463_BMCR_HP_MDIX   0x0020
#define KSZ8463_BMCR_FORCE_MDI   0x0010
#define KSZ8463_BMCR_AUTO_MDIX_DIS   0x0008
#define KSZ8463_BMCR_FAR_END_FAULT_DIS   0x0004
#define KSZ8463_BMCR_TRANSMIT_DIS   0x0002
#define KSZ8463_BMCR_LED_DIS   0x0001
#define KSZ8463_BMSR_100BT4   0x8000
#define KSZ8463_BMSR_100BTX_FD   0x4000
#define KSZ8463_BMSR_100BTX_HD   0x2000
#define KSZ8463_BMSR_10BT_FD   0x1000
#define KSZ8463_BMSR_10BT_HD   0x0800
#define KSZ8463_BMSR_PREAMBLE_SUPPR   0x0040
#define KSZ8463_BMSR_AN_COMPLETE   0x0020
#define KSZ8463_BMSR_FAR_END_FAULT   0x0010
#define KSZ8463_BMSR_AN_CAPABLE   0x0008
#define KSZ8463_BMSR_LINK_STATUS   0x0004
#define KSZ8463_BMSR_JABBER_TEST   0x0002
#define KSZ8463_BMSR_EXTENDED_CAPABLE   0x0001
#define KSZ8463_PHYID1_DEFAULT   0x0022
#define KSZ8463_PHYID2_DEFAULT   0x1430
#define KSZ8463_ANAR_NEXT_PAGE   0x8000
#define KSZ8463_ANAR_REMOTE_FAULT   0x2000
#define KSZ8463_ANAR_PAUSE   0x0400
#define KSZ8463_ANAR_100BTX_FD   0x0100
#define KSZ8463_ANAR_100BTX_HD   0x0080
#define KSZ8463_ANAR_10BT_FD   0x0040
#define KSZ8463_ANAR_10BT_HD   0x0020
#define KSZ8463_ANAR_SELECTOR   0x001F
#define KSZ8463_ANAR_SELECTOR_DEFAULT   0x0001
#define KSZ8463_ANLPAR_NEXT_PAGE   0x8000
#define KSZ8463_ANLPAR_LP_ACK   0x4000
#define KSZ8463_ANLPAR_REMOTE_FAULT   0x2000
#define KSZ8463_ANLPAR_PAUSE   0x0400
#define KSZ8463_ANLPAR_100BTX_FD   0x0100
#define KSZ8463_ANLPAR_100BTX_HD   0x0080
#define KSZ8463_ANLPAR_10BT_FD   0x0040
#define KSZ8463_ANLPAR_10BT_HD   0x0020
#define KSZ8463_LINKMD_TEST_EN   0x8000
#define KSZ8463_LINKMD_RESULT   0x6000
#define KSZ8463_LINKMD_SHORT   0x1000
#define KSZ8463_LINKMD_FAULT_COUNT   0x01FF
#define KSZ8463_PHYSCS_POL_REVERSE   0x0020
#define KSZ8463_PHYSCS_MDIX_STATUS   0x0010
#define KSZ8463_PHYSCS_FORCE_LINK   0x0008
#define KSZ8463_PHYSCS_EEE_EN   0x0004
#define KSZ8463_PHYSCS_REMOTE_LOOPBACK   0x0002
#define KSZ8463_CIDER_FAMILY_ID   0xFF00
#define KSZ8463_CIDER_FAMILY_ID_DEFAULT   0x8400
#define KSZ8463_CIDER_CHIP_ID   0x00F0
#define KSZ8463_CIDER_CHIP_ID_ML_FML   0x0040
#define KSZ8463_CIDER_CHIP_ID_RL_FRL   0x0050
#define KSZ8463_CIDER_REVISION_ID   0x000E
#define KSZ8463_CIDER_START_SWITCH   0x0001
#define KSZ8463_PnCR2_INGRESS_VLAN_FILT   0x4000
#define KSZ8463_PnCR2_DISCARD_NON_PVID_PACKETS   0x2000
#define KSZ8463_PnCR2_FORCE_FLOW_CTRL   0x1000
#define KSZ8463_PnCR2_BACK_PRESSURE_EN   0x0800
#define KSZ8463_PnCR2_TRANSMIT_EN   0x0400
#define KSZ8463_PnCR2_RECEIVE_EN   0x0200
#define KSZ8463_PnCR2_LEARNING_DIS   0x0100
#define KSZ8463_PnCR2_SNIFFER_PORT   0x0080
#define KSZ8463_PnCR2_RECEIVE_SNIFF   0x0040
#define KSZ8463_PnCR2_TRANSMIT_SNIFF   0x0020
#define KSZ8463_PnCR2_USER_PRIO_CEILING   0x0008
#define KSZ8463_PnCR2_PORT_VLAN_MEMBERSHIP   0x0007
#define KSZ8463_PnSR_HP_MDIX   0x8000
#define KSZ8463_PnSR_POL_REVERSE   0x2000
#define KSZ8463_PnSR_TX_FLOW_CTRL_EN   0x1000
#define KSZ8463_PnSR_RX_FLOW_CTRL_EN   0x0800
#define KSZ8463_PnSR_OP_SPEED   0x0400
#define KSZ8463_PnSR_OP_DUPLEX   0x0200
#define KSZ8463_PnSR_FAR_END_FAULT   0x0100
#define KSZ8463_PnSR_MDIX_STATUS   0x0080
#define KSZ8463_PnSR_AN_DONE   0x0040
#define KSZ8463_PnSR_LINK_STATUS   0x0020
#define KSZ8463_PnSR_LP_FLOW_CTRL_CAPABLE   0x0010
#define KSZ8463_PnSR_LP_100BTX_FD_CAPABLE   0x0008
#define KSZ8463_PnSR_LP_100BTX_HF_CAPABLE   0x0004
#define KSZ8463_PnSR_LP_10BT_FD_CAPABLE   0x0002
#define KSZ8463_PnSR_LP_10BT_HD_CAPABLE   0x0001
#define KSZ8463_SGCR8_QUEUE_PRIO_MAPPING   0xC000
#define KSZ8463_SGCR8_FLUSH_DYNAMIC_MAC_TABLE   0x0400
#define KSZ8463_SGCR8_FLUSH_STATIC_MAC_TABLE   0x0200
#define KSZ8463_SGCR8_TAIL_TAG_EN   0x0100
#define KSZ8463_TAIL_TAG_ENCODE(port)   ((port) & 0x03)
#define KSZ8463_TAIL_TAG_DECODE(tag)   (((tag) & 0x01) + 1)


error_t ksz8463Init (NetInterface *interface)
 KSZ8463 Ethernet switch initialization. More...
bool_t ksz8463GetLinkState (NetInterface *interface, uint8_t port)
 Get link state. More...
void ksz8463Tick (NetInterface *interface)
 KSZ8463 timer handler. More...
void ksz8463EnableIrq (NetInterface *interface)
 Enable interrupts. More...
void ksz8463DisableIrq (NetInterface *interface)
 Disable interrupts. More...
void ksz8463EventHandler (NetInterface *interface)
 KSZ8463 event handler. More...
error_t ksz8463TagFrame (NetInterface *interface, NetBuffer *buffer, size_t *offset, uint8_t port, uint16_t *type)
 Add tail tag to Ethernet frame. More...
error_t ksz8463UntagFrame (NetInterface *interface, uint8_t **frame, size_t *length, uint8_t *port)
 Decode tail tag from incoming Ethernet frame. More...
void ksz8463WritePhyReg (NetInterface *interface, uint8_t port, uint8_t address, uint16_t data)
 Write PHY register. More...
uint16_t ksz8463ReadPhyReg (NetInterface *interface, uint8_t port, uint8_t address)
 Read PHY register. More...
void ksz8463DumpPhyReg (NetInterface *interface, uint8_t port)
 Dump PHY registers for debugging purpose. More...
void ksz8463WriteSwitchReg (NetInterface *interface, uint16_t address, uint16_t data)
 Write switch register. More...
uint16_t ksz8463ReadSwitchReg (NetInterface *interface, uint16_t address)
 Read switch register. More...
void ksz8463DumpSwitchReg (NetInterface *interface)
 Dump switch registers for debugging purpose. More...


const PhyDriver ksz8463PhyDriver
 KSZ8463 Ethernet switch driver. More...

Detailed Description

KSZ8463 3-port Ethernet switch.


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

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

Oryx Embedded SARL (www.oryx-embedded.com)

Definition in file ksz8463_driver.h.

Macro Definition Documentation

◆ KSZ8463_ANAR

#define KSZ8463_ANAR   0x04

Definition at line 55 of file ksz8463_driver.h.

◆ KSZ8463_ANAR_100BTX_FD

#define KSZ8463_ANAR_100BTX_FD   0x0100

Definition at line 122 of file ksz8463_driver.h.

◆ KSZ8463_ANAR_100BTX_HD

#define KSZ8463_ANAR_100BTX_HD   0x0080

Definition at line 123 of file ksz8463_driver.h.

◆ KSZ8463_ANAR_10BT_FD

#define KSZ8463_ANAR_10BT_FD   0x0040

Definition at line 124 of file ksz8463_driver.h.

◆ KSZ8463_ANAR_10BT_HD

#define KSZ8463_ANAR_10BT_HD   0x0020

Definition at line 125 of file ksz8463_driver.h.


#define KSZ8463_ANAR_NEXT_PAGE   0x8000

Definition at line 119 of file ksz8463_driver.h.


#define KSZ8463_ANAR_PAUSE   0x0400

Definition at line 121 of file ksz8463_driver.h.


#define KSZ8463_ANAR_REMOTE_FAULT   0x2000

Definition at line 120 of file ksz8463_driver.h.


#define KSZ8463_ANAR_SELECTOR   0x001F

Definition at line 126 of file ksz8463_driver.h.


#define KSZ8463_ANAR_SELECTOR_DEFAULT   0x0001

Definition at line 127 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR   0x05

Definition at line 56 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_100BTX_FD   0x0100

Definition at line 134 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_100BTX_HD   0x0080

Definition at line 135 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_10BT_FD   0x0040

Definition at line 136 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_10BT_HD   0x0020

Definition at line 137 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_LP_ACK   0x4000

Definition at line 131 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_NEXT_PAGE   0x8000

Definition at line 130 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_PAUSE   0x0400

Definition at line 133 of file ksz8463_driver.h.


#define KSZ8463_ANLPAR_REMOTE_FAULT   0x2000

Definition at line 132 of file ksz8463_driver.h.

◆ KSZ8463_BMCR

#define KSZ8463_BMCR   0x00

Definition at line 51 of file ksz8463_driver.h.


#define KSZ8463_BMCR_AN_EN   0x1000

Definition at line 85 of file ksz8463_driver.h.


#define KSZ8463_BMCR_AUTO_MDIX_DIS   0x0008

Definition at line 93 of file ksz8463_driver.h.


#define KSZ8463_BMCR_COL_TEST   0x0080

Definition at line 90 of file ksz8463_driver.h.


#define KSZ8463_BMCR_FAR_END_FAULT_DIS   0x0004

Definition at line 94 of file ksz8463_driver.h.

◆ KSZ8463_BMCR_FORCE_100

#define KSZ8463_BMCR_FORCE_100   0x2000

Definition at line 84 of file ksz8463_driver.h.


#define KSZ8463_BMCR_FORCE_FULL_DUPLEX   0x0100

Definition at line 89 of file ksz8463_driver.h.


#define KSZ8463_BMCR_FORCE_MDI   0x0010

Definition at line 92 of file ksz8463_driver.h.


#define KSZ8463_BMCR_HP_MDIX   0x0020

Definition at line 91 of file ksz8463_driver.h.


#define KSZ8463_BMCR_ISOLATE   0x0400

Definition at line 87 of file ksz8463_driver.h.


#define KSZ8463_BMCR_LED_DIS   0x0001

Definition at line 96 of file ksz8463_driver.h.


#define KSZ8463_BMCR_LOOPBACK   0x4000

Definition at line 83 of file ksz8463_driver.h.


#define KSZ8463_BMCR_POWER_DOWN   0x0800

Definition at line 86 of file ksz8463_driver.h.


#define KSZ8463_BMCR_RESTART_AN   0x0200

Definition at line 88 of file ksz8463_driver.h.


#define KSZ8463_BMCR_TRANSMIT_DIS   0x0002

Definition at line 95 of file ksz8463_driver.h.

◆ KSZ8463_BMSR

#define KSZ8463_BMSR   0x01

Definition at line 52 of file ksz8463_driver.h.

◆ KSZ8463_BMSR_100BT4

#define KSZ8463_BMSR_100BT4   0x8000

Definition at line 99 of file ksz8463_driver.h.

◆ KSZ8463_BMSR_100BTX_FD

#define KSZ8463_BMSR_100BTX_FD   0x4000

Definition at line 100 of file ksz8463_driver.h.

◆ KSZ8463_BMSR_100BTX_HD

#define KSZ8463_BMSR_100BTX_HD   0x2000

Definition at line 101 of file ksz8463_driver.h.

◆ KSZ8463_BMSR_10BT_FD

#define KSZ8463_BMSR_10BT_FD   0x1000

Definition at line 102 of file ksz8463_driver.h.

◆ KSZ8463_BMSR_10BT_HD

#define KSZ8463_BMSR_10BT_HD   0x0800

Definition at line 103 of file ksz8463_driver.h.


#define KSZ8463_BMSR_AN_CAPABLE   0x0008

Definition at line 107 of file ksz8463_driver.h.


#define KSZ8463_BMSR_AN_COMPLETE   0x0020

Definition at line 105 of file ksz8463_driver.h.


#define KSZ8463_BMSR_EXTENDED_CAPABLE   0x0001

Definition at line 110 of file ksz8463_driver.h.


#define KSZ8463_BMSR_FAR_END_FAULT   0x0010

Definition at line 106 of file ksz8463_driver.h.


#define KSZ8463_BMSR_JABBER_TEST   0x0002

Definition at line 109 of file ksz8463_driver.h.


#define KSZ8463_BMSR_LINK_STATUS   0x0004

Definition at line 108 of file ksz8463_driver.h.


#define KSZ8463_BMSR_PREAMBLE_SUPPR   0x0040

Definition at line 104 of file ksz8463_driver.h.


#define KSZ8463_CIDER   0x00

Definition at line 61 of file ksz8463_driver.h.


#define KSZ8463_CIDER_CHIP_ID   0x00F0

Definition at line 155 of file ksz8463_driver.h.


#define KSZ8463_CIDER_CHIP_ID_ML_FML   0x0040

Definition at line 156 of file ksz8463_driver.h.


#define KSZ8463_CIDER_CHIP_ID_RL_FRL   0x0050

Definition at line 157 of file ksz8463_driver.h.


#define KSZ8463_CIDER_FAMILY_ID   0xFF00

Definition at line 153 of file ksz8463_driver.h.


#define KSZ8463_CIDER_FAMILY_ID_DEFAULT   0x8400

Definition at line 154 of file ksz8463_driver.h.


#define KSZ8463_CIDER_REVISION_ID   0x000E

Definition at line 158 of file ksz8463_driver.h.


#define KSZ8463_CIDER_START_SWITCH   0x0001

Definition at line 159 of file ksz8463_driver.h.


#define KSZ8463_LINKMD   0x1D

Definition at line 57 of file ksz8463_driver.h.


#define KSZ8463_LINKMD_FAULT_COUNT   0x01FF

Definition at line 143 of file ksz8463_driver.h.


#define KSZ8463_LINKMD_RESULT   0x6000

Definition at line 141 of file ksz8463_driver.h.


#define KSZ8463_LINKMD_SHORT   0x1000

Definition at line 142 of file ksz8463_driver.h.


#define KSZ8463_LINKMD_TEST_EN   0x8000

Definition at line 140 of file ksz8463_driver.h.

◆ KSZ8463_P1CR1

#define KSZ8463_P1CR1   0x6C

Definition at line 67 of file ksz8463_driver.h.

◆ KSZ8463_P1CR2

#define KSZ8463_P1CR2   0x6E

Definition at line 68 of file ksz8463_driver.h.

◆ KSZ8463_P1SR

#define KSZ8463_P1SR   0x80

Definition at line 69 of file ksz8463_driver.h.

◆ KSZ8463_P2CR1

#define KSZ8463_P2CR1   0x84

Definition at line 70 of file ksz8463_driver.h.

◆ KSZ8463_P2CR2

#define KSZ8463_P2CR2   0x86

Definition at line 71 of file ksz8463_driver.h.

◆ KSZ8463_P2SR

#define KSZ8463_P2SR   0x98

Definition at line 72 of file ksz8463_driver.h.

◆ KSZ8463_P3CR1

#define KSZ8463_P3CR1   0x9C

Definition at line 73 of file ksz8463_driver.h.

◆ KSZ8463_P3CR2

#define KSZ8463_P3CR2   0x9E

Definition at line 74 of file ksz8463_driver.h.

◆ KSZ8463_PHYID1

#define KSZ8463_PHYID1   0x02

Definition at line 53 of file ksz8463_driver.h.


#define KSZ8463_PHYID1_DEFAULT   0x0022

Definition at line 113 of file ksz8463_driver.h.

◆ KSZ8463_PHYID2

#define KSZ8463_PHYID2   0x03

Definition at line 54 of file ksz8463_driver.h.


#define KSZ8463_PHYID2_DEFAULT   0x1430

Definition at line 116 of file ksz8463_driver.h.


#define KSZ8463_PHYSCS   0x1F

Definition at line 58 of file ksz8463_driver.h.


#define KSZ8463_PHYSCS_EEE_EN   0x0004

Definition at line 149 of file ksz8463_driver.h.


#define KSZ8463_PHYSCS_FORCE_LINK   0x0008

Definition at line 148 of file ksz8463_driver.h.


#define KSZ8463_PHYSCS_MDIX_STATUS   0x0010

Definition at line 147 of file ksz8463_driver.h.


#define KSZ8463_PHYSCS_POL_REVERSE   0x0020

Definition at line 146 of file ksz8463_driver.h.


#define KSZ8463_PHYSCS_REMOTE_LOOPBACK   0x0002

Definition at line 150 of file ksz8463_driver.h.

◆ KSZ8463_PnCR1

#define KSZ8463_PnCR1 (   port)    (0x54 + ((port) * 0x18))

Definition at line 78 of file ksz8463_driver.h.

◆ KSZ8463_PnCR2

#define KSZ8463_PnCR2 (   port)    (0x56 + ((port) * 0x18))

Definition at line 79 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_BACK_PRESSURE_EN   0x0800

Definition at line 165 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_DISCARD_NON_PVID_PACKETS   0x2000

Definition at line 163 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_FORCE_FLOW_CTRL   0x1000

Definition at line 164 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_INGRESS_VLAN_FILT   0x4000

Definition at line 162 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_LEARNING_DIS   0x0100

Definition at line 168 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_PORT_VLAN_MEMBERSHIP   0x0007

Definition at line 173 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_RECEIVE_EN   0x0200

Definition at line 167 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_RECEIVE_SNIFF   0x0040

Definition at line 170 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_SNIFFER_PORT   0x0080

Definition at line 169 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_TRANSMIT_EN   0x0400

Definition at line 166 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_TRANSMIT_SNIFF   0x0020

Definition at line 171 of file ksz8463_driver.h.


#define KSZ8463_PnCR2_USER_PRIO_CEILING   0x0008

Definition at line 172 of file ksz8463_driver.h.

◆ KSZ8463_PnSR

#define KSZ8463_PnSR (   port)    (0x68 + ((port) * 0x18))

Definition at line 80 of file ksz8463_driver.h.


#define KSZ8463_PnSR_AN_DONE   0x0040

Definition at line 184 of file ksz8463_driver.h.


#define KSZ8463_PnSR_FAR_END_FAULT   0x0100

Definition at line 182 of file ksz8463_driver.h.


#define KSZ8463_PnSR_HP_MDIX   0x8000

Definition at line 176 of file ksz8463_driver.h.


#define KSZ8463_PnSR_LINK_STATUS   0x0020

Definition at line 185 of file ksz8463_driver.h.


#define KSZ8463_PnSR_LP_100BTX_FD_CAPABLE   0x0008

Definition at line 187 of file ksz8463_driver.h.


#define KSZ8463_PnSR_LP_100BTX_HF_CAPABLE   0x0004

Definition at line 188 of file ksz8463_driver.h.


#define KSZ8463_PnSR_LP_10BT_FD_CAPABLE   0x0002

Definition at line 189 of file ksz8463_driver.h.


#define KSZ8463_PnSR_LP_10BT_HD_CAPABLE   0x0001

Definition at line 190 of file ksz8463_driver.h.


#define KSZ8463_PnSR_LP_FLOW_CTRL_CAPABLE   0x0010

Definition at line 186 of file ksz8463_driver.h.


#define KSZ8463_PnSR_MDIX_STATUS   0x0080

Definition at line 183 of file ksz8463_driver.h.


#define KSZ8463_PnSR_OP_DUPLEX   0x0200

Definition at line 181 of file ksz8463_driver.h.


#define KSZ8463_PnSR_OP_SPEED   0x0400

Definition at line 180 of file ksz8463_driver.h.


#define KSZ8463_PnSR_POL_REVERSE   0x2000

Definition at line 177 of file ksz8463_driver.h.


#define KSZ8463_PnSR_RX_FLOW_CTRL_EN   0x0800

Definition at line 179 of file ksz8463_driver.h.


#define KSZ8463_PnSR_TX_FLOW_CTRL_EN   0x1000

Definition at line 178 of file ksz8463_driver.h.

◆ KSZ8463_PORT1

#define KSZ8463_PORT1   1

Definition at line 38 of file ksz8463_driver.h.

◆ KSZ8463_PORT2

#define KSZ8463_PORT2   2

Definition at line 39 of file ksz8463_driver.h.

◆ KSZ8463_SGCR1

#define KSZ8463_SGCR1   0x02

Definition at line 62 of file ksz8463_driver.h.

◆ KSZ8463_SGCR2

#define KSZ8463_SGCR2   0x04

Definition at line 63 of file ksz8463_driver.h.

◆ KSZ8463_SGCR3

#define KSZ8463_SGCR3   0x06

Definition at line 64 of file ksz8463_driver.h.

◆ KSZ8463_SGCR6

#define KSZ8463_SGCR6   0x0C

Definition at line 65 of file ksz8463_driver.h.

◆ KSZ8463_SGCR7

#define KSZ8463_SGCR7   0x0E

Definition at line 66 of file ksz8463_driver.h.

◆ KSZ8463_SGCR8

#define KSZ8463_SGCR8   0xAC

Definition at line 75 of file ksz8463_driver.h.


#define KSZ8463_SGCR8_FLUSH_DYNAMIC_MAC_TABLE   0x0400

Definition at line 194 of file ksz8463_driver.h.


#define KSZ8463_SGCR8_FLUSH_STATIC_MAC_TABLE   0x0200

Definition at line 195 of file ksz8463_driver.h.



Definition at line 197 of file ksz8463_driver.h.


#define KSZ8463_SGCR8_QUEUE_PRIO_MAPPING   0xC000

Definition at line 193 of file ksz8463_driver.h.


#define KSZ8463_SGCR8_TAIL_TAG_EN   0x0100

Definition at line 196 of file ksz8463_driver.h.


#define KSZ8463_SPI_CMD_ADDR   0x7FC0

Definition at line 44 of file ksz8463_driver.h.

◆ KSZ8463_SPI_CMD_B0

#define KSZ8463_SPI_CMD_B0   0x0004

Definition at line 48 of file ksz8463_driver.h.

◆ KSZ8463_SPI_CMD_B1

#define KSZ8463_SPI_CMD_B1   0x0008

Definition at line 47 of file ksz8463_driver.h.

◆ KSZ8463_SPI_CMD_B2

#define KSZ8463_SPI_CMD_B2   0x0010

Definition at line 46 of file ksz8463_driver.h.

◆ KSZ8463_SPI_CMD_B3

#define KSZ8463_SPI_CMD_B3   0x0020

Definition at line 45 of file ksz8463_driver.h.


#define KSZ8463_SPI_CMD_READ   0x0000

Definition at line 42 of file ksz8463_driver.h.


#define KSZ8463_SPI_CMD_WRITE   0x8000

Definition at line 43 of file ksz8463_driver.h.


#define KSZ8463_TAIL_TAG_DECODE (   tag)    (((tag) & 0x01) + 1)

Definition at line 202 of file ksz8463_driver.h.


#define KSZ8463_TAIL_TAG_ENCODE (   port)    ((port) & 0x03)

Definition at line 200 of file ksz8463_driver.h.

Function Documentation

◆ ksz8463DisableIrq()

void ksz8463DisableIrq ( NetInterface interface)

Disable interrupts.

[in]interfaceUnderlying network interface

Definition at line 324 of file ksz8463_driver.c.

◆ ksz8463DumpPhyReg()

void ksz8463DumpPhyReg ( NetInterface interface,
uint8_t  port 

Dump PHY registers for debugging purpose.

[in]interfaceUnderlying network interface
[in]portPort number

Definition at line 603 of file ksz8463_driver.c.

◆ ksz8463DumpSwitchReg()

void ksz8463DumpSwitchReg ( NetInterface interface)

Dump switch registers for debugging purpose.

[in]interfaceUnderlying network interface

Definition at line 729 of file ksz8463_driver.c.

◆ ksz8463EnableIrq()

void ksz8463EnableIrq ( NetInterface interface)

Enable interrupts.

[in]interfaceUnderlying network interface

Definition at line 314 of file ksz8463_driver.c.

◆ ksz8463EventHandler()

void ksz8463EventHandler ( NetInterface interface)

KSZ8463 event handler.

[in]interfaceUnderlying network interface

Definition at line 334 of file ksz8463_driver.c.

◆ ksz8463GetLinkState()

bool_t ksz8463GetLinkState ( NetInterface interface,
uint8_t  port 

Get link state.

[in]interfaceUnderlying network interface
[in]portPort number
Link state

Definition at line 168 of file ksz8463_driver.c.

◆ ksz8463Init()

error_t ksz8463Init ( NetInterface interface)

KSZ8463 Ethernet switch initialization.

[in]interfaceUnderlying network interface
Error code

Definition at line 75 of file ksz8463_driver.c.

◆ ksz8463ReadPhyReg()

uint16_t ksz8463ReadPhyReg ( NetInterface interface,
uint8_t  port,
uint8_t  address 

Read PHY register.

[in]interfaceUnderlying network interface
[in]portPort number
[in]addressPHY register address
Register value

Definition at line 589 of file ksz8463_driver.c.

◆ ksz8463ReadSwitchReg()

uint16_t ksz8463ReadSwitchReg ( NetInterface interface,
uint16_t  address 

Read switch register.

[in]interfaceUnderlying network interface
[in]addressSwitch register address
Register value

Definition at line 677 of file ksz8463_driver.c.

◆ ksz8463TagFrame()

error_t ksz8463TagFrame ( NetInterface interface,
NetBuffer buffer,
size_t *  offset,
uint8_t  port,
uint16_t *  type 

Add tail tag to Ethernet frame.

[in]interfaceUnderlying network interface
[in]bufferMulti-part buffer containing the payload
[in,out]offsetOffset to the first payload byte
[in]portSwitch port identifier
[in,out]typeEthernet type
Error code

Definition at line 476 of file ksz8463_driver.c.

◆ ksz8463Tick()

void ksz8463Tick ( NetInterface interface)

KSZ8463 timer handler.

[in]interfaceUnderlying network interface

Definition at line 216 of file ksz8463_driver.c.

◆ ksz8463UntagFrame()

error_t ksz8463UntagFrame ( NetInterface interface,
uint8_t **  frame,
size_t *  length,
uint8_t *  port 

Decode tail tag from incoming Ethernet frame.

[in]interfaceUnderlying network interface
[in,out]framePointer to the received Ethernet frame
[in,out]lengthLength of the frame, in bytes
[out]portSwitch port identifier
Error code

Definition at line 528 of file ksz8463_driver.c.

◆ ksz8463WritePhyReg()

void ksz8463WritePhyReg ( NetInterface interface,
uint8_t  port,
uint8_t  address,
uint16_t  data 

Write PHY register.

[in]interfaceUnderlying network interface
[in]portPort number
[in]addressPHY register address
[in]dataRegister value

Definition at line 573 of file ksz8463_driver.c.

◆ ksz8463WriteSwitchReg()

void ksz8463WriteSwitchReg ( NetInterface interface,
uint16_t  address,
uint16_t  data 

Write switch register.

[in]interfaceUnderlying network interface
[in]addressSwitch register address
[in]dataRegister value

Definition at line 627 of file ksz8463_driver.c.

Variable Documentation

◆ ksz8463PhyDriver

const PhyDriver ksz8463PhyDriver

KSZ8463 Ethernet switch driver.

Definition at line 45 of file ksz8463_driver.c.