Sitara AM335x Gigabit Ethernet MAC driver. More...
#include "soc_am335x.h"
#include "hw_types.h"
#include "hw_cm_per.h"
#include "hw_control_am335x.h"
#include "hw_cpsw_ale.h"
#include "hw_cpsw_cpdma.h"
#include "hw_cpsw_cpdma_stateram.h"
#include "hw_cpsw_port.h"
#include "hw_cpsw_sl.h"
#include "hw_cpsw_ss.h"
#include "hw_cpsw_wr.h"
#include "hw_mdio.h"
#include "interrupt.h"
#include "core/net.h"
#include "drivers/mac/am335x_eth_driver.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL NIC_TRACE_LEVEL |
#define | MDIO_INPUT_CLK 125000000 |
#define | MDIO_OUTPUT_CLK 1000000 |
Functions | |
error_t | am335xEthInitPort1 (NetInterface *interface) |
AM335x Ethernet MAC initialization (port 1) More... | |
error_t | am335xEthInitPort2 (NetInterface *interface) |
AM335x Ethernet MAC initialization (port 2) More... | |
void | am335xEthInitInstance (NetInterface *interface) |
Initialize CPSW instance. More... | |
__weak_func void | am335xEthInitGpio (NetInterface *interface) |
GPIO configuration. More... | |
void | am335xEthInitBufferDesc (NetInterface *interface) |
Initialize buffer descriptor lists. More... | |
void | am335xEthTick (NetInterface *interface) |
AM335x Ethernet MAC timer handler. More... | |
void | am335xEthEnableIrq (NetInterface *interface) |
Enable interrupts. More... | |
void | am335xEthDisableIrq (NetInterface *interface) |
Disable interrupts. More... | |
void | am335xEthTxIrqHandler (void) |
Ethernet MAC transmit interrupt. More... | |
void | am335xEthRxIrqHandler (void) |
Ethernet MAC receive interrupt. More... | |
void | am335xEthEventHandler (NetInterface *interface) |
AM335x Ethernet MAC event handler. More... | |
error_t | am335xEthSendPacketPort1 (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
Send a packet (port 1) More... | |
error_t | am335xEthSendPacketPort2 (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
Send a packet (port 2) More... | |
error_t | am335xEthUpdateMacAddrFilter (NetInterface *interface) |
Configure MAC address filtering. More... | |
error_t | am335xEthUpdateMacConfig (NetInterface *interface) |
Adjust MAC configuration parameters for proper operation. More... | |
void | am335xEthWritePhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data) |
Write PHY register. More... | |
uint16_t | am335xEthReadPhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr) |
Read PHY register. More... | |
void | am335xEthWriteEntry (uint_t index, const Am335xAleEntry *entry) |
Write an ALE table entry. More... | |
void | am335xEthReadEntry (uint_t index, Am335xAleEntry *entry) |
Read an ALE table entry. More... | |
uint_t | am335xEthFindFreeEntry (void) |
Find a free entry in the ALE table. More... | |
uint_t | am335xEthFindVlanEntry (uint_t vlanId) |
Search the ALE table for the specified VLAN entry. More... | |
uint_t | am335xEthFindVlanAddrEntry (uint_t vlanId, MacAddr *macAddr) |
Search the ALE table for the specified VLAN/address entry. More... | |
error_t | am335xEthAddVlanEntry (uint_t port, uint_t vlanId) |
Add a VLAN entry in the ALE table. More... | |
error_t | am335xEthAddVlanAddrEntry (uint_t port, uint_t vlanId, MacAddr *macAddr) |
Add a VLAN/address entry in the ALE table. More... | |
error_t | am335xEthDeleteVlanAddrEntry (uint_t port, uint_t vlanId, MacAddr *macAddr) |
Remove a VLAN/address entry from the ALE table. More... | |
Variables | |
const NicDriver | am335xEthPort1Driver |
AM335x Ethernet MAC driver (port1) More... | |
const NicDriver | am335xEthPort2Driver |
AM335x Ethernet MAC driver (port2) More... | |
Detailed Description
Sitara AM335x Gigabit Ethernet MAC driver.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file am335x_eth_driver.c.
Macro Definition Documentation
◆ MDIO_INPUT_CLK
#define MDIO_INPUT_CLK 125000000 |
Definition at line 53 of file am335x_eth_driver.c.
◆ MDIO_OUTPUT_CLK
#define MDIO_OUTPUT_CLK 1000000 |
Definition at line 55 of file am335x_eth_driver.c.
◆ TRACE_LEVEL
#define TRACE_LEVEL NIC_TRACE_LEVEL |
Definition at line 32 of file am335x_eth_driver.c.
Function Documentation
◆ am335xEthAddVlanAddrEntry()
Add a VLAN/address entry in the ALE table.
- Parameters
-
[in] port Port number [in] vlanId VLAN identifier [in] macAddr MAC address
- Returns
- Error code
Definition at line 1808 of file am335x_eth_driver.c.
◆ am335xEthAddVlanEntry()
Add a VLAN entry in the ALE table.
- Parameters
-
[in] port Port number [in] vlanId VLAN identifier
- Returns
- Error code
Definition at line 1748 of file am335x_eth_driver.c.
◆ am335xEthDeleteVlanAddrEntry()
Remove a VLAN/address entry from the ALE table.
- Parameters
-
[in] port Port number [in] vlanId VLAN identifier [in] macAddr MAC address
- Returns
- Error code
Definition at line 1879 of file am335x_eth_driver.c.
◆ am335xEthDisableIrq()
void am335xEthDisableIrq | ( | NetInterface * | interface | ) |
Disable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 894 of file am335x_eth_driver.c.
◆ am335xEthEnableIrq()
void am335xEthEnableIrq | ( | NetInterface * | interface | ) |
Enable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 858 of file am335x_eth_driver.c.
◆ am335xEthEventHandler()
void am335xEthEventHandler | ( | NetInterface * | interface | ) |
AM335x Ethernet MAC event handler.
- Parameters
-
[in] interface Underlying network interface
Definition at line 1072 of file am335x_eth_driver.c.
◆ am335xEthFindFreeEntry()
uint_t am335xEthFindFreeEntry | ( | void | ) |
Find a free entry in the ALE table.
- Returns
- Index of the first free entry
Definition at line 1621 of file am335x_eth_driver.c.
◆ am335xEthFindVlanAddrEntry()
Search the ALE table for the specified VLAN/address entry.
- Parameters
-
[in] vlanId VLAN identifier [in] macAddr MAC address
- Returns
- Index of the matching entry
Definition at line 1697 of file am335x_eth_driver.c.
◆ am335xEthFindVlanEntry()
Search the ALE table for the specified VLAN entry.
- Parameters
-
[in] vlanId VLAN identifier
- Returns
- Index of the matching entry
Definition at line 1655 of file am335x_eth_driver.c.
◆ am335xEthInitBufferDesc()
void am335xEthInitBufferDesc | ( | NetInterface * | interface | ) |
Initialize buffer descriptor lists.
- Parameters
-
[in] interface Underlying network interface
Definition at line 715 of file am335x_eth_driver.c.
◆ am335xEthInitGpio()
__weak_func void am335xEthInitGpio | ( | NetInterface * | interface | ) |
GPIO configuration.
- Parameters
-
[in] interface Underlying network interface
Definition at line 500 of file am335x_eth_driver.c.
◆ am335xEthInitInstance()
void am335xEthInitInstance | ( | NetInterface * | interface | ) |
Initialize CPSW instance.
- Parameters
-
[in] interface Underlying network interface
Definition at line 327 of file am335x_eth_driver.c.
◆ am335xEthInitPort1()
error_t am335xEthInitPort1 | ( | NetInterface * | interface | ) |
AM335x Ethernet MAC initialization (port 1)
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 178 of file am335x_eth_driver.c.
◆ am335xEthInitPort2()
error_t am335xEthInitPort2 | ( | NetInterface * | interface | ) |
AM335x Ethernet MAC initialization (port 2)
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 253 of file am335x_eth_driver.c.
◆ am335xEthReadEntry()
void am335xEthReadEntry | ( | uint_t | index, |
Am335xAleEntry * | entry | ||
) |
Read an ALE table entry.
- Parameters
-
[in] index Entry index [out] entry Pointer to the ALE table entry
Definition at line 1604 of file am335x_eth_driver.c.
◆ am335xEthReadPhyReg()
uint16_t am335xEthReadPhyReg | ( | uint8_t | opcode, |
uint8_t | phyAddr, | ||
uint8_t | regAddr | ||
) |
Read PHY register.
- Parameters
-
[in] opcode Access type (2 bits) [in] phyAddr PHY address (5 bits) [in] regAddr Register address (5 bits)
- Returns
- Register value
Definition at line 1543 of file am335x_eth_driver.c.
◆ am335xEthRxIrqHandler()
void am335xEthRxIrqHandler | ( | void | ) |
Ethernet MAC receive interrupt.
Definition at line 1025 of file am335x_eth_driver.c.
◆ am335xEthSendPacketPort1()
error_t am335xEthSendPacketPort1 | ( | NetInterface * | interface, |
const NetBuffer * | buffer, | ||
size_t | offset, | ||
NetTxAncillary * | ancillary | ||
) |
Send a packet (port 1)
- Parameters
-
[in] interface Underlying network interface [in] buffer Multi-part buffer containing the data to send [in] offset Offset to the first data byte [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
Definition at line 1206 of file am335x_eth_driver.c.
◆ am335xEthSendPacketPort2()
error_t am335xEthSendPacketPort2 | ( | NetInterface * | interface, |
const NetBuffer * | buffer, | ||
size_t | offset, | ||
NetTxAncillary * | ancillary | ||
) |
Send a packet (port 2)
- Parameters
-
[in] interface Underlying network interface [in] buffer Multi-part buffer containing the data to send [in] offset Offset to the first data byte [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
Definition at line 1295 of file am335x_eth_driver.c.
◆ am335xEthTick()
void am335xEthTick | ( | NetInterface * | interface | ) |
AM335x Ethernet MAC timer handler.
This routine is periodically called by the TCP/IP stack to handle periodic operations such as polling the link state
- Parameters
-
[in] interface Underlying network interface
Definition at line 821 of file am335x_eth_driver.c.
◆ am335xEthTxIrqHandler()
void am335xEthTxIrqHandler | ( | void | ) |
Ethernet MAC transmit interrupt.
Definition at line 929 of file am335x_eth_driver.c.
◆ am335xEthUpdateMacAddrFilter()
error_t am335xEthUpdateMacAddrFilter | ( | NetInterface * | interface | ) |
Configure MAC address filtering.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 1380 of file am335x_eth_driver.c.
◆ am335xEthUpdateMacConfig()
error_t am335xEthUpdateMacConfig | ( | NetInterface * | interface | ) |
Adjust MAC configuration parameters for proper operation.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 1438 of file am335x_eth_driver.c.
◆ am335xEthWriteEntry()
void am335xEthWriteEntry | ( | uint_t | index, |
const Am335xAleEntry * | entry | ||
) |
Write an ALE table entry.
- Parameters
-
[in] index Entry index [in] entry Pointer to the ALE table entry
Definition at line 1586 of file am335x_eth_driver.c.
◆ am335xEthWritePhyReg()
void am335xEthWritePhyReg | ( | uint8_t | opcode, |
uint8_t | phyAddr, | ||
uint8_t | regAddr, | ||
uint16_t | data | ||
) |
Write PHY register.
- Parameters
-
[in] opcode Access type (2 bits) [in] phyAddr PHY address (5 bits) [in] regAddr Register address (5 bits) [in] data Register value
Definition at line 1504 of file am335x_eth_driver.c.
Variable Documentation
◆ am335xEthPort1Driver
const NicDriver am335xEthPort1Driver |
AM335x Ethernet MAC driver (port1)
Definition at line 126 of file am335x_eth_driver.c.
◆ am335xEthPort2Driver
const NicDriver am335xEthPort2Driver |
AM335x Ethernet MAC driver (port2)
Definition at line 151 of file am335x_eth_driver.c.