ksz9477_driver.c
void nicNotifyLinkChange(NetInterface *interface)
Process link state change notification.
Definition: nic.c:559
uint8_t ksz9477ReadSwitchReg8(NetInterface *interface, uint16_t address)
Read switch register (8 bits)
Definition: ksz9477_driver.c:1746
error_t ksz9477Init(NetInterface *interface)
KSZ9477 Ethernet switch initialization.
Definition: ksz9477_driver.c:94
error_t ksz9477TagFrame(NetInterface *interface, NetBuffer *buffer, size_t *offset, NetTxAncillary *ancillary)
Add tail tag to Ethernet frame.
Definition: ksz9477_driver.c:473
#define KSZ9477_PORTn_XMII_CTRL1_IF_TYPE
Definition: ksz9477_driver.h:1888
#define KSZ9477_STATIC_TABLE_ENTRY1_VALID
Definition: ksz9477_driver.h:1604
#define KSZ9477_ALU_TABLE_ENTRY2_PORT1_FORWARD
Definition: ksz9477_driver.h:1594
#define KSZ9477_TAIL_TAG_PORT_BLOCKING_OVERRIDE
Definition: ksz9477_driver.h:67
#define KSZ9477_GLOBAL_PORT_MIRROR_SNOOP_CTRL_IGMP_SNOOP_EN
Definition: ksz9477_driver.h:1490
#define KSZ9477_STATIC_MCAST_TABLE_CTRL_TABLE_SELECT
Definition: ksz9477_driver.h:1572
#define KSZ9477_UNKONWN_MULTICAST_CTRL
Definition: ksz9477_driver.h:169
#define KSZ9477_PORTn_OP_CTRL0_TAIL_TAG_EN
Definition: ksz9477_driver.h:1865
#define KSZ9477_UNKONWN_MULTICAST_CTRL_FWD_MAP_PORT6
Definition: ksz9477_driver.h:1437
#define KSZ9477_STATIC_TABLE_ENTRY2_OVERRIDE
Definition: ksz9477_driver.h:1611
#define KSZ9477_SWITCH_MAC_CTRL0_FRAME_LEN_CHECK_EN
Definition: ksz9477_driver.h:1455
void ksz9477SetUnknownMcastFwdPorts(NetInterface *interface, bool_t enable, uint32_t forwardPorts)
Set forward ports for unknown multicast packets.
Definition: ksz9477_driver.c:1508
void ksz9477EventHandler(NetInterface *interface)
KSZ9477 event handler.
Definition: ksz9477_driver.c:348
uint16_t ksz9477ReadSwitchReg16(NetInterface *interface, uint16_t address)
Read switch register (16 bits)
Definition: ksz9477_driver.c:1837
#define KSZ9477_SWITCH_LUE_CTRL2_FLUSH_OPTION_DYNAMIC
Definition: ksz9477_driver.h:1388
#define KSZ9477_ALU_TABLE_ENTRY2_PORT7_FORWARD
Definition: ksz9477_driver.h:1588
#define KSZ9477_ALU_TABLE_CTRL_START_FINISH
Definition: ksz9477_driver.h:1559
void ksz9477EnableRsvdMcastTable(NetInterface *interface, bool_t enable)
Enable reserved multicast table.
Definition: ksz9477_driver.c:977
#define KSZ9477_ALU_TABLE_ENTRY2_PORT4_FORWARD
Definition: ksz9477_driver.h:1591
#define KSZ9477_GLOBAL_PORT_MIRROR_SNOOP_CTRL
Definition: ksz9477_driver.h:215
#define KSZ9477_PORTn_XMII_CTRL1_RGMII_ID_IG
Definition: ksz9477_driver.h:1885
uint16_t ksz9477ReadPhyReg(NetInterface *interface, uint8_t port, uint8_t address)
Read PHY register.
Definition: ksz9477_driver.c:1587
#define KSZ9477_UNKONWN_MULTICAST_CTRL_FWD
Definition: ksz9477_driver.h:1430
#define KSZ9477_ALU_TABLE_ENTRY2_PORT_FORWARD
Definition: ksz9477_driver.h:1587
#define KSZ9477_PORTn_MSTP_STATE_TRANSMIT_EN
Definition: ksz9477_driver.h:1957
#define KSZ9477_SWITCH_LUE_CTRL0_AGE_COUNT_DEFAULT
Definition: ksz9477_driver.h:1365
#define KSZ9477_SWITCH_OP_START_SWITCH
Definition: ksz9477_driver.h:1348
error_t ksz9477GetStaticFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the static MAC table.
Definition: ksz9477_driver.c:1208
void ksz9477SetAgingTime(NetInterface *interface, uint32_t agingTime)
Set aging time for dynamic filtering entries.
Definition: ksz9477_driver.c:896
#define KSZ9477_ALU_TABLE_ENTRY2_PORT3_FORWARD
Definition: ksz9477_driver.h:1592
#define KSZ9477_GLOBAL_PORT_MIRROR_SNOOP_CTRL_MLD_SNOOP_EN
Definition: ksz9477_driver.h:1492
#define KSZ9477_PORTn_MSTP_STATE_RECEIVE_EN
Definition: ksz9477_driver.h:1958
void ksz9477WriteSwitchReg16(NetInterface *interface, uint16_t address, uint16_t data)
Write switch register (16 bits)
Definition: ksz9477_driver.c:1793
void ksz9477FlushDynamicFdbTable(NetInterface *interface, uint8_t port)
Flush dynamic MAC table.
Definition: ksz9477_driver.c:1461
uint16_t ksz9477ReadMmdReg(NetInterface *interface, uint8_t port, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
Definition: ksz9477_driver.c:1677
error_t ethPadFrame(NetBuffer *buffer, size_t *length)
Ethernet frame padding.
Definition: ethernet_misc.c:147
bool_t ksz9477GetLinkState(NetInterface *interface, uint8_t port)
Get link state.
Definition: ksz9477_driver.c:584
void ksz9477WriteSwitchReg32(NetInterface *interface, uint16_t address, uint32_t data)
Write switch register (32 bits)
Definition: ksz9477_driver.c:1885
#define KSZ9477_SWITCH_LUE_CTRL0_HASH_OPTION_CRC
Definition: ksz9477_driver.h:1369
#define KSZ9477_MMD_LED_MODE_RESERVED_DEFAULT
Definition: ksz9477_driver.h:1193
void ksz9477DumpPhyReg(NetInterface *interface, uint8_t port)
Dump PHY registers for debugging purpose.
Definition: ksz9477_driver.c:1623
#define KSZ9477_UNKONWN_MULTICAST_CTRL_FWD_MAP
Definition: ksz9477_driver.h:1431
#define KSZ9477_TAIL_TAG_NORMAL_ADDR_LOOKUP
Definition: ksz9477_driver.h:66
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
Definition: net_mem.c:297
#define KSZ9477_STATIC_TABLE_ENTRY2_PORT_FORWARD
Definition: ksz9477_driver.h:1613
#define KSZ9477_ALU_TABLE_ENTRY2_PORT5_FORWARD
Definition: ksz9477_driver.h:1590
#define KSZ9477_ALU_TABLE_ENTRY2_PORT2_FORWARD
Definition: ksz9477_driver.h:1593
error_t ksz9477AddStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Add a new entry to the static MAC table.
Definition: ksz9477_driver.c:1006
void ksz9477FlushStaticFdbTable(NetInterface *interface)
Flush static MAC table.
Definition: ksz9477_driver.c:1305
uint32_t ksz9477GetLinkSpeed(NetInterface *interface, uint8_t port)
Get link speed.
Definition: ksz9477_driver.c:618
void ksz9477WriteSwitchReg8(NetInterface *interface, uint16_t address, uint8_t data)
Write switch register (8 bits)
Definition: ksz9477_driver.c:1703
#define KSZ9477_SWITCH_LUE_CTRL1_FLUSH_ALU_TABLE
Definition: ksz9477_driver.h:1375
void ksz9477EnableMldSnooping(NetInterface *interface, bool_t enable)
Enable MLD snooping.
Definition: ksz9477_driver.c:947
#define KSZ9477_SWITCH_LUE_CTRL0_RESERVED_MCAST_LOOKUP_EN
Definition: ksz9477_driver.h:1366
#define KSZ9477_PORTn_ETH_PHY_REG(port, addr)
Definition: ksz9477_driver.h:1013
#define KSZ9477_SWITCH_LUE_CTRL2_FLUSH_OPTION
Definition: ksz9477_driver.h:1386
#define KSZ9477_PORTn_XMII_CTRL1_SPEED_1000
Definition: ksz9477_driver.h:1884
uint32_t ksz9477ReadSwitchReg32(NetInterface *interface, uint16_t address)
Read switch register (32 bits)
Definition: ksz9477_driver.c:1931
void ksz9477WriteMmdReg(NetInterface *interface, uint8_t port, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
Definition: ksz9477_driver.c:1649
#define KSZ9477_UNKONWN_MULTICAST_CTRL_FWD_MAP_ALL
Definition: ksz9477_driver.h:1439
NicDuplexMode ksz9477GetDuplexMode(NetInterface *interface, uint8_t port)
Get duplex mode.
Definition: ksz9477_driver.c:713
const SwitchDriver ksz9477SwitchDriver
KSZ9477 Ethernet switch driver.
Definition: ksz9477_driver.c:45
void ksz9477EnableIgmpSnooping(NetInterface *interface, bool_t enable)
Enable IGMP snooping.
Definition: ksz9477_driver.c:917
#define KSZ9477_PORTn_XMII_CTRL1_RGMII_ID_EG
Definition: ksz9477_driver.h:1886
error_t netBufferAppend(NetBuffer *dest, const void *src, size_t length)
Append data a multi-part buffer.
Definition: net_mem.c:604
SwitchPortState ksz9477GetPortState(NetInterface *interface, uint8_t port)
Get port state.
Definition: ksz9477_driver.c:833
#define KSZ9477_ALU_TABLE_ENTRY2_PORT6_FORWARD
Definition: ksz9477_driver.h:1589
void ksz9477WritePhyReg(NetInterface *interface, uint8_t port, uint8_t address, uint16_t data)
Write PHY register.
Definition: ksz9477_driver.c:1553
#define KSZ9477_STATIC_MCAST_TABLE_CTRL
Definition: ksz9477_driver.h:228
__weak_func void ksz9477InitHook(NetInterface *interface)
KSZ9477 custom configuration.
Definition: ksz9477_driver.c:248
#define KSZ9477_PORTn_XMII_CTRL0_SPEED_10_100
Definition: ksz9477_driver.h:1880
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
Definition: os_port_chibios.c:202
KSZ9477 7-port Gigabit Ethernet switch driver.
error_t ksz9477UntagFrame(NetInterface *interface, uint8_t **frame, size_t *length, NetRxAncillary *ancillary)
Decode tail tag from incoming Ethernet frame.
Definition: ksz9477_driver.c:532
#define KSZ9477_STATIC_MCAST_TABLE_CTRL_START_FINISH
Definition: ksz9477_driver.h:1571
#define KSZ9477_SWITCH_LUE_CTRL3_AGE_PERIOD_DEFAULT
Definition: ksz9477_driver.h:1395
#define KSZ9477_PORTn_XMII_CTRL0_DUPLEX
Definition: ksz9477_driver.h:1878
void ksz9477SetPortState(NetInterface *interface, uint8_t port, SwitchPortState state)
Set port state.
Definition: ksz9477_driver.c:777
#define KSZ9477_SWITCH_LUE_CTRL1_FLUSH_MSTP_ENTRIES
Definition: ksz9477_driver.h:1376
TCP/IP stack core.
#define KSZ9477_MMD_LED_MODE_LED_MODE_TRI_COLOR_DUAL
Definition: ksz9477_driver.h:1190
#define KSZ9477_ALU_TABLE_CTRL_VALID_ENTRY_OR_SEARCH_END
Definition: ksz9477_driver.h:1561
Helper functions for Ethernet.
const uint16_t ksz9477IngressTailTag[6]
Tail tag rules (host to KSZ9477)
Definition: ksz9477_driver.c:77
#define KSZ9477_STATIC_MCAST_TABLE_CTRL_ACTION
Definition: ksz9477_driver.h:1573
#define KSZ9477_PORTn_XMII_CTRL1_IF_TYPE_RGMII
Definition: ksz9477_driver.h:1889
#define KSZ9477_ALU_TABLE_CTRL_ACTION_SEARCH
Definition: ksz9477_driver.h:1567
Debugging facilities.
#define KSZ9477_PORTn_MSTP_STATE_LEARNING_DIS
Definition: ksz9477_driver.h:1959
error_t ksz9477GetDynamicFdbEntry(NetInterface *interface, uint_t index, SwitchFdbEntry *entry)
Read an entry from the dynamic MAC table.
Definition: ksz9477_driver.c:1354
error_t ksz9477DeleteStaticFdbEntry(NetInterface *interface, const SwitchFdbEntry *entry)
Remove an entry from the static MAC table.
Definition: ksz9477_driver.c:1128
#define KSZ9477_STATIC_MCAST_TABLE_CTRL_TABLE_INDEX
Definition: ksz9477_driver.h:1570
#define KSZ9477_MMDACR_FUNC_DATA_NO_POST_INC
Definition: ksz9477_driver.h:1115