mcf5225x_eth_driver.h File Reference

Coldfire V2 MCF5225x Ethernet MAC driver. More...

Go to the source code of this file.

Data Structures

struct  Mcf5225xTxBufferDesc
 Transmit buffer descriptor. More...
 
struct  Mcf5225xRxBufferDesc
 Receive buffer descriptor. More...
 

Macros

#define MCF5225X_ETH_TX_BUFFER_COUNT   2
 
#define MCF5225X_ETH_TX_BUFFER_SIZE   1536
 
#define MCF5225X_ETH_RX_BUFFER_COUNT   4
 
#define MCF5225X_ETH_RX_BUFFER_SIZE   1536
 
#define MCF5225X_ETH_IRQ_LEVEL   4
 
#define MCF5225X_ETH_IRQ_PRIORITY   1
 
#define FEC_ALIGN16(p)   ((void *) ((((uint32_t) (p)) + 15) & 0xFFFFFFF0))
 
#define FEC_TX_BD_R   0x8000
 
#define FEC_TX_BD_TO1   0x4000
 
#define FEC_TX_BD_W   0x2000
 
#define FEC_TX_BD_TO2   0x1000
 
#define FEC_TX_BD_L   0x0800
 
#define FEC_TX_BD_TC   0x0400
 
#define FEC_TX_BD_ABC   0x0200
 
#define FEC_RX_BD_E   0x8000
 
#define FEC_RX_BD_RO1   0x4000
 
#define FEC_RX_BD_W   0x2000
 
#define FEC_RX_BD_RO2   0x1000
 
#define FEC_RX_BD_L   0x0800
 
#define FEC_RX_BD_M   0x0100
 
#define FEC_RX_BD_BC   0x0080
 
#define FEC_RX_BD_MC   0x0040
 
#define FEC_RX_BD_LG   0x0020
 
#define FEC_RX_BD_NO   0x0010
 
#define FEC_RX_BD_CR   0x0004
 
#define FEC_RX_BD_OV   0x0002
 
#define FEC_RX_BD_TR   0x0001
 

Functions

error_t mcf5225xEthInit (NetInterface *interface)
 MCF5225x Ethernet MAC initialization. More...
 
void mcf5225xEthInitGpio (NetInterface *interface)
 GPIO configuration. More...
 
void mcf5225xEthInitBufferDesc (NetInterface *interface)
 Initialize buffer descriptors. More...
 
void mcf5225xEthTick (NetInterface *interface)
 MCF5225x Ethernet MAC timer handler. More...
 
void mcf5225xEthEnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void mcf5225xEthDisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
void mcf5225xEthEventHandler (NetInterface *interface)
 MCF5225x Ethernet MAC event handler. More...
 
error_t mcf5225xEthSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send a packet. More...
 
error_t mcf5225xEthReceivePacket (NetInterface *interface)
 Receive a packet. More...
 
error_t mcf5225xEthUpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
error_t mcf5225xEthUpdateMacConfig (NetInterface *interface)
 Adjust MAC configuration parameters for proper operation. More...
 
void mcf5225xEthWritePhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
 Write PHY register. More...
 
uint16_t mcf5225xEthReadPhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
 Read PHY register. More...
 
uint32_t mcf5225xEthCalcCrc (const void *data, size_t length)
 CRC calculation. More...
 

Variables

const NicDriver mcf5225xEthDriver
 MCF5225x Ethernet MAC driver. More...
 

Detailed Description

Coldfire V2 MCF5225x 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 mcf5225x_eth_driver.h.

Macro Definition Documentation

◆ FEC_ALIGN16

#define FEC_ALIGN16 (   p)    ((void *) ((((uint32_t) (p)) + 15) & 0xFFFFFFF0))

Definition at line 77 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_BC

#define FEC_RX_BD_BC   0x0080

Definition at line 95 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_CR

#define FEC_RX_BD_CR   0x0004

Definition at line 99 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_E

#define FEC_RX_BD_E   0x8000

Definition at line 89 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_L

#define FEC_RX_BD_L   0x0800

Definition at line 93 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_LG

#define FEC_RX_BD_LG   0x0020

Definition at line 97 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_M

#define FEC_RX_BD_M   0x0100

Definition at line 94 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_MC

#define FEC_RX_BD_MC   0x0040

Definition at line 96 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_NO

#define FEC_RX_BD_NO   0x0010

Definition at line 98 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_OV

#define FEC_RX_BD_OV   0x0002

Definition at line 100 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_RO1

#define FEC_RX_BD_RO1   0x4000

Definition at line 90 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_RO2

#define FEC_RX_BD_RO2   0x1000

Definition at line 92 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_TR

#define FEC_RX_BD_TR   0x0001

Definition at line 101 of file mcf5225x_eth_driver.h.

◆ FEC_RX_BD_W

#define FEC_RX_BD_W   0x2000

Definition at line 91 of file mcf5225x_eth_driver.h.

◆ FEC_TX_BD_ABC

#define FEC_TX_BD_ABC   0x0200

Definition at line 86 of file mcf5225x_eth_driver.h.

◆ FEC_TX_BD_L

#define FEC_TX_BD_L   0x0800

Definition at line 84 of file mcf5225x_eth_driver.h.

◆ FEC_TX_BD_R

#define FEC_TX_BD_R   0x8000

Definition at line 80 of file mcf5225x_eth_driver.h.

◆ FEC_TX_BD_TC

#define FEC_TX_BD_TC   0x0400

Definition at line 85 of file mcf5225x_eth_driver.h.

◆ FEC_TX_BD_TO1

#define FEC_TX_BD_TO1   0x4000

Definition at line 81 of file mcf5225x_eth_driver.h.

◆ FEC_TX_BD_TO2

#define FEC_TX_BD_TO2   0x1000

Definition at line 83 of file mcf5225x_eth_driver.h.

◆ FEC_TX_BD_W

#define FEC_TX_BD_W   0x2000

Definition at line 82 of file mcf5225x_eth_driver.h.

◆ MCF5225X_ETH_IRQ_LEVEL

#define MCF5225X_ETH_IRQ_LEVEL   4

Definition at line 64 of file mcf5225x_eth_driver.h.

◆ MCF5225X_ETH_IRQ_PRIORITY

#define MCF5225X_ETH_IRQ_PRIORITY   1

Definition at line 71 of file mcf5225x_eth_driver.h.

◆ MCF5225X_ETH_RX_BUFFER_COUNT

#define MCF5225X_ETH_RX_BUFFER_COUNT   4

Definition at line 50 of file mcf5225x_eth_driver.h.

◆ MCF5225X_ETH_RX_BUFFER_SIZE

#define MCF5225X_ETH_RX_BUFFER_SIZE   1536

Definition at line 57 of file mcf5225x_eth_driver.h.

◆ MCF5225X_ETH_TX_BUFFER_COUNT

#define MCF5225X_ETH_TX_BUFFER_COUNT   2

Definition at line 36 of file mcf5225x_eth_driver.h.

◆ MCF5225X_ETH_TX_BUFFER_SIZE

#define MCF5225X_ETH_TX_BUFFER_SIZE   1536

Definition at line 43 of file mcf5225x_eth_driver.h.

Function Documentation

◆ mcf5225xEthCalcCrc()

uint32_t mcf5225xEthCalcCrc ( const void *  data,
size_t  length 
)

CRC calculation.

Parameters
[in]dataPointer to the data over which to calculate the CRC
[in]lengthNumber of bytes to process
Returns
Resulting CRC value

Definition at line 887 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthDisableIrq()

void mcf5225xEthDisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 353 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthEnableIrq()

void mcf5225xEthEnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 318 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthEventHandler()

void mcf5225xEthEventHandler ( NetInterface interface)

MCF5225x Ethernet MAC event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 462 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthInit()

error_t mcf5225xEthInit ( NetInterface interface)

MCF5225x Ethernet MAC initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 89 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthInitBufferDesc()

void mcf5225xEthInitBufferDesc ( NetInterface interface)

Initialize buffer descriptors.

Parameters
[in]interfaceUnderlying network interface

Definition at line 239 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthInitGpio()

void mcf5225xEthInitGpio ( NetInterface interface)

GPIO configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 197 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthReadPhyReg()

uint16_t mcf5225xEthReadPhyReg ( 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 840 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthReceivePacket()

error_t mcf5225xEthReceivePacket ( NetInterface interface)

Receive a packet.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 588 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthSendPacket()

error_t mcf5225xEthSendPacket ( 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 518 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthTick()

void mcf5225xEthTick ( NetInterface interface)

MCF5225x 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 293 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthUpdateMacAddrFilter()

error_t mcf5225xEthUpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 667 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthUpdateMacConfig()

error_t mcf5225xEthUpdateMacConfig ( NetInterface interface)

Adjust MAC configuration parameters for proper operation.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 756 of file mcf5225x_eth_driver.c.

◆ mcf5225xEthWritePhyReg()

void mcf5225xEthWritePhyReg ( 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 798 of file mcf5225x_eth_driver.c.

Variable Documentation

◆ mcf5225xEthDriver

const NicDriver mcf5225xEthDriver
extern

MCF5225x Ethernet MAC driver.

Definition at line 62 of file mcf5225x_eth_driver.c.