tms570_eth_driver.c File Reference

TMS570 Ethernet MAC driver. More...

#include "hw_reg_access.h"
#include "hw_emac.h"
#include "hw_emac_ctrl.h"
#include "hw_mdio.h"
#include "gio.h"
#include "sys_vim.h"
#include "core/net.h"
#include "drivers/mac/tms570_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   75000000
 
#define MDIO_OUTPUT_CLK   1000000
 
#define CPPI_SWAP(x)   ((uint32_t) (x))
 

Functions

error_t tms570EthInit (NetInterface *interface)
 TMS570 Ethernet MAC initialization. More...
 
__weak_func void tms570EthInitGpio (NetInterface *interface)
 GPIO configuration. More...
 
void tms570EthInitBufferDesc (NetInterface *interface)
 Initialize buffer descriptor lists. More...
 
void tms570EthTick (NetInterface *interface)
 TMS570 Ethernet MAC timer handler. More...
 
void tms570EthEnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void tms570EthDisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
void tms570EthTxIrqHandler (void)
 Ethernet MAC transmit interrupt. More...
 
void tms570EthRxIrqHandler (void)
 Ethernet MAC receive interrupt. More...
 
void tms570EthEventHandler (NetInterface *interface)
 TMS570 Ethernet MAC event handler. More...
 
error_t tms570EthSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send a packet. More...
 
error_t tms570EthReceivePacket (NetInterface *interface)
 Receive a packet. More...
 
error_t tms570EthUpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
error_t tms570EthUpdateMacConfig (NetInterface *interface)
 Adjust MAC configuration parameters for proper operation. More...
 
void tms570EthWritePhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
 Write PHY register. More...
 
uint16_t tms570EthReadPhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
 Read PHY register. More...
 

Variables

const NicDriver tms570EthDriver
 TMS570 Ethernet MAC driver. More...
 

Detailed Description

TMS570 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file tms570_eth_driver.c.

Macro Definition Documentation

◆ CPPI_SWAP

#define CPPI_SWAP (   x)    ((uint32_t) (x))

Definition at line 65 of file tms570_eth_driver.c.

◆ MDIO_INPUT_CLK

#define MDIO_INPUT_CLK   75000000

Definition at line 57 of file tms570_eth_driver.c.

◆ MDIO_OUTPUT_CLK

#define MDIO_OUTPUT_CLK   1000000

Definition at line 59 of file tms570_eth_driver.c.

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 32 of file tms570_eth_driver.c.

Function Documentation

◆ tms570EthDisableIrq()

void tms570EthDisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 497 of file tms570_eth_driver.c.

◆ tms570EthEnableIrq()

void tms570EthEnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 468 of file tms570_eth_driver.c.

◆ tms570EthEventHandler()

void tms570EthEventHandler ( NetInterface interface)

TMS570 Ethernet MAC event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 640 of file tms570_eth_driver.c.

◆ tms570EthInit()

error_t tms570EthInit ( NetInterface interface)

TMS570 Ethernet MAC initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 146 of file tms570_eth_driver.c.

◆ tms570EthInitBufferDesc()

void tms570EthInitBufferDesc ( NetInterface interface)

Initialize buffer descriptor lists.

Parameters
[in]interfaceUnderlying network interface

Definition at line 357 of file tms570_eth_driver.c.

◆ tms570EthInitGpio()

__weak_func void tms570EthInitGpio ( NetInterface interface)

GPIO configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 330 of file tms570_eth_driver.c.

◆ tms570EthReadPhyReg()

uint16_t tms570EthReadPhyReg ( uint8_t  opcode,
uint8_t  phyAddr,
uint8_t  regAddr 
)

Read PHY register.

Parameters
[in]opcodeAccess type (2 bits)
[in]phyAddrPHY address (5 bits)
[in]regAddrRegister address (5 bits)
Returns
Register value

Definition at line 989 of file tms570_eth_driver.c.

◆ tms570EthReceivePacket()

error_t tms570EthReceivePacket ( NetInterface interface)

Receive a packet.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 746 of file tms570_eth_driver.c.

◆ tms570EthRxIrqHandler()

void tms570EthRxIrqHandler ( void  )

Ethernet MAC receive interrupt.

Definition at line 601 of file tms570_eth_driver.c.

◆ tms570EthSendPacket()

error_t tms570EthSendPacket ( NetInterface interface,
const NetBuffer buffer,
size_t  offset,
NetTxAncillary ancillary 
)

Send a packet.

Parameters
[in]interfaceUnderlying network interface
[in]bufferMulti-part buffer containing the data to send
[in]offsetOffset to the first data byte
[in]ancillaryAdditional options passed to the stack along with the packet
Returns
Error code

Definition at line 668 of file tms570_eth_driver.c.

◆ tms570EthTick()

void tms570EthTick ( NetInterface interface)

TMS570 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]interfaceUnderlying network interface

Definition at line 431 of file tms570_eth_driver.c.

◆ tms570EthTxIrqHandler()

void tms570EthTxIrqHandler ( void  )

Ethernet MAC transmit interrupt.

Definition at line 532 of file tms570_eth_driver.c.

◆ tms570EthUpdateMacAddrFilter()

error_t tms570EthUpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 844 of file tms570_eth_driver.c.

◆ tms570EthUpdateMacConfig()

error_t tms570EthUpdateMacConfig ( NetInterface interface)

Adjust MAC configuration parameters for proper operation.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 907 of file tms570_eth_driver.c.

◆ tms570EthWritePhyReg()

void tms570EthWritePhyReg ( uint8_t  opcode,
uint8_t  phyAddr,
uint8_t  regAddr,
uint16_t  data 
)

Write PHY register.

Parameters
[in]opcodeAccess type (2 bits)
[in]phyAddrPHY address (5 bits)
[in]regAddrRegister address (5 bits)
[in]dataRegister value

Definition at line 950 of file tms570_eth_driver.c.

Variable Documentation

◆ tms570EthDriver

error_t tms570EthUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
#define TRUE
Definition: os_port.h:50
void tms570EthEnableIrq(NetInterface *interface)
Enable interrupts.
error_t tms570EthSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
#define FALSE
Definition: os_port.h:46
void tms570EthTick(NetInterface *interface)
TMS570 Ethernet MAC timer handler.
void tms570EthEventHandler(NetInterface *interface)
TMS570 Ethernet MAC event handler.
error_t tms570EthInit(NetInterface *interface)
TMS570 Ethernet MAC initialization.
#define ETH_MTU
Definition: ethernet.h:116
void tms570EthWritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
void tms570EthDisableIrq(NetInterface *interface)
Disable interrupts.
error_t tms570EthUpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.
uint16_t tms570EthReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83