avr32_eth_driver.h File Reference

AVR32 Ethernet MAC controller. More...

Go to the source code of this file.

Data Structures

struct  Avr32TxBufferDesc
 Transmit buffer descriptor. More...
struct  Avr32RxBufferDesc
 Receive buffer descriptor. More...


#define AVR32_ETH_TX_BUFFER_SIZE   1536
#define AVR32_ETH_RX_BUFFER_COUNT   48
#define AVR32_ETH_RX_BUFFER_SIZE   128
#define AVR32_ETH_IRQ_PRIORITY   2
#define MACB_RMII_EREFCK_MASK   (1 << (AVR32_MACB_TX_CLK_0_PIN - 32))
#define MACB_RMII_ETXEN_MASK   (1 << (AVR32_MACB_TX_EN_0_PIN - 32))
#define MACB_RMII_ETX0_MASK   (1 << (AVR32_MACB_TXD_0_PIN - 32))
#define MACB_RMII_ETX1_MASK   (1 << (AVR32_MACB_TXD_1_PIN - 32))
#define MACB_RMII_ERX0_MASK   (1 << (AVR32_MACB_RXD_0_PIN - 32))
#define MACB_RMII_ERX1_MASK   (1 << (AVR32_MACB_RXD_1_PIN - 32))
#define MACB_RMII_ERXER_MASK   (1 << (AVR32_MACB_RX_ER_0_PIN - 32))
#define MACB_RMII_ECRSDV_MASK   (1 << (AVR32_MACB_RX_DV_0_PIN - 32))
#define MACB_RMII_MDC_MASK   (1 << (AVR32_MACB_MDC_0_PIN - 32))
#define MACB_RMII_MDIO_MASK   (1 << (AVR32_MACB_MDIO_0_PIN - 32))
#define MACB_MAN_SOF_01   (1 << AVR32_MACB_MAN_SOF_OFFSET)
#define MACB_MAN_RW_01   (1 << AVR32_MACB_MAN_RW_OFFSET)
#define MACB_MAN_RW_10   (2 << AVR32_MACB_MAN_RW_OFFSET)
#define MACB_TX_USED   0x80000000
#define MACB_TX_WRAP   0x40000000
#define MACB_TX_ERROR   0x20000000
#define MACB_TX_UNDERRUN   0x10000000
#define MACB_TX_EXHAUSTED   0x08000000
#define MACB_TX_NO_CRC   0x00010000
#define MACB_TX_LAST   0x00008000
#define MACB_TX_LENGTH   0x000007FF
#define MACB_RX_WRAP   0x00000002
#define MACB_RX_OWNERSHIP   0x00000001
#define MACB_RX_BROADCAST   0x80000000
#define MACB_RX_MULTICAST_HASH   0x40000000
#define MACB_RX_UNICAST_HASH   0x20000000
#define MACB_RX_EXT_ADDR   0x10000000
#define MACB_RX_SAR1   0x04000000
#define MACB_RX_SAR2   0x02000000
#define MACB_RX_SAR3   0x01000000
#define MACB_RX_SAR4   0x00800000
#define MACB_RX_TYPE_ID   0x00400000
#define MACB_RX_VLAN_TAG   0x00200000
#define MACB_RX_PRIORITY_TAG   0x00100000
#define MACB_RX_VLAN_PRIORITY   0x000E0000
#define MACB_RX_CFI   0x00010000
#define MACB_RX_EOF   0x00008000
#define MACB_RX_SOF   0x00004000
#define MACB_RX_OFFSET   0x00003000
#define MACB_RX_LENGTH   0x00000FFF


error_t avr32EthInit (NetInterface *interface)
 AVR32 Ethernet MAC initialization. More...
void avr32EthInitGpio (NetInterface *interface)
void avr32EthInitBufferDesc (NetInterface *interface)
 Initialize buffer descriptors. More...
void avr32EthTick (NetInterface *interface)
 AVR32 Ethernet MAC timer handler. More...
void avr32EthEnableIrq (NetInterface *interface)
 Enable interrupts. More...
void avr32EthDisableIrq (NetInterface *interface)
 Disable interrupts. More...
void avr32EthIrqWrapper (void)
bool_t avr32EthIrqHandler (void)
 AVR32 Ethernet MAC interrupt service routine. More...
void avr32EthEventHandler (NetInterface *interface)
 AVR32 Ethernet MAC event handler. More...
error_t avr32EthSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset)
 Send a packet. More...
error_t avr32EthReceivePacket (NetInterface *interface)
 Receive a packet. More...
error_t avr32EthUpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
error_t avr32EthUpdateMacConfig (NetInterface *interface)
 Adjust MAC configuration parameters for proper operation. More...
void avr32EthWritePhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
 Write PHY register. More...
uint16_t avr32EthReadPhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
 Read PHY register. More...


const NicDriver avr32EthDriver
 AVR32 Ethernet MAC driver. More...

Detailed Description

AVR32 Ethernet MAC controller.


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 avr32_eth_driver.h.

Macro Definition Documentation


#define AVR32_ETH_IRQ_PRIORITY   2

Definition at line 64 of file avr32_eth_driver.h.


#define AVR32_ETH_RX_BUFFER_COUNT   48

Definition at line 50 of file avr32_eth_driver.h.


#define AVR32_ETH_RX_BUFFER_SIZE   128

Definition at line 57 of file avr32_eth_driver.h.



Definition at line 36 of file avr32_eth_driver.h.


#define AVR32_ETH_TX_BUFFER_SIZE   1536

Definition at line 43 of file avr32_eth_driver.h.



Definition at line 90 of file avr32_eth_driver.h.


#define MACB_MAN_RW_01   (1 << AVR32_MACB_MAN_RW_OFFSET)

Definition at line 88 of file avr32_eth_driver.h.


#define MACB_MAN_RW_10   (2 << AVR32_MACB_MAN_RW_OFFSET)

Definition at line 89 of file avr32_eth_driver.h.


#define MACB_MAN_SOF_01   (1 << AVR32_MACB_MAN_SOF_OFFSET)

Definition at line 87 of file avr32_eth_driver.h.


#define MACB_RMII_ECRSDV_MASK   (1 << (AVR32_MACB_RX_DV_0_PIN - 32))

Definition at line 77 of file avr32_eth_driver.h.


#define MACB_RMII_EREFCK_MASK   (1 << (AVR32_MACB_TX_CLK_0_PIN - 32))

Definition at line 70 of file avr32_eth_driver.h.


#define MACB_RMII_ERX0_MASK   (1 << (AVR32_MACB_RXD_0_PIN - 32))

Definition at line 74 of file avr32_eth_driver.h.


#define MACB_RMII_ERX1_MASK   (1 << (AVR32_MACB_RXD_1_PIN - 32))

Definition at line 75 of file avr32_eth_driver.h.


#define MACB_RMII_ERXER_MASK   (1 << (AVR32_MACB_RX_ER_0_PIN - 32))

Definition at line 76 of file avr32_eth_driver.h.


#define MACB_RMII_ETX0_MASK   (1 << (AVR32_MACB_TXD_0_PIN - 32))

Definition at line 72 of file avr32_eth_driver.h.


#define MACB_RMII_ETX1_MASK   (1 << (AVR32_MACB_TXD_1_PIN - 32))

Definition at line 73 of file avr32_eth_driver.h.


#define MACB_RMII_ETXEN_MASK   (1 << (AVR32_MACB_TX_EN_0_PIN - 32))

Definition at line 71 of file avr32_eth_driver.h.




#define MACB_RMII_MDC_MASK   (1 << (AVR32_MACB_MDC_0_PIN - 32))

Definition at line 78 of file avr32_eth_driver.h.


#define MACB_RMII_MDIO_MASK   (1 << (AVR32_MACB_MDIO_0_PIN - 32))

Definition at line 79 of file avr32_eth_driver.h.



Definition at line 103 of file avr32_eth_driver.h.


#define MACB_RX_BROADCAST   0x80000000

Definition at line 106 of file avr32_eth_driver.h.


#define MACB_RX_CFI   0x00010000

Definition at line 118 of file avr32_eth_driver.h.


#define MACB_RX_EOF   0x00008000

Definition at line 119 of file avr32_eth_driver.h.


#define MACB_RX_EXT_ADDR   0x10000000

Definition at line 109 of file avr32_eth_driver.h.


#define MACB_RX_LENGTH   0x00000FFF

Definition at line 122 of file avr32_eth_driver.h.


#define MACB_RX_MULTICAST_HASH   0x40000000

Definition at line 107 of file avr32_eth_driver.h.


#define MACB_RX_OFFSET   0x00003000

Definition at line 121 of file avr32_eth_driver.h.


#define MACB_RX_OWNERSHIP   0x00000001

Definition at line 105 of file avr32_eth_driver.h.


#define MACB_RX_PRIORITY_TAG   0x00100000

Definition at line 116 of file avr32_eth_driver.h.


#define MACB_RX_SAR1   0x04000000

Definition at line 110 of file avr32_eth_driver.h.


#define MACB_RX_SAR2   0x02000000

Definition at line 111 of file avr32_eth_driver.h.


#define MACB_RX_SAR3   0x01000000

Definition at line 112 of file avr32_eth_driver.h.


#define MACB_RX_SAR4   0x00800000

Definition at line 113 of file avr32_eth_driver.h.


#define MACB_RX_SOF   0x00004000

Definition at line 120 of file avr32_eth_driver.h.


#define MACB_RX_TYPE_ID   0x00400000

Definition at line 114 of file avr32_eth_driver.h.


#define MACB_RX_UNICAST_HASH   0x20000000

Definition at line 108 of file avr32_eth_driver.h.


#define MACB_RX_VLAN_PRIORITY   0x000E0000

Definition at line 117 of file avr32_eth_driver.h.


#define MACB_RX_VLAN_TAG   0x00200000

Definition at line 115 of file avr32_eth_driver.h.


#define MACB_RX_WRAP   0x00000002

Definition at line 104 of file avr32_eth_driver.h.


#define MACB_TX_ERROR   0x20000000

Definition at line 95 of file avr32_eth_driver.h.


#define MACB_TX_EXHAUSTED   0x08000000

Definition at line 97 of file avr32_eth_driver.h.


#define MACB_TX_LAST   0x00008000

Definition at line 99 of file avr32_eth_driver.h.


#define MACB_TX_LENGTH   0x000007FF

Definition at line 100 of file avr32_eth_driver.h.


#define MACB_TX_NO_CRC   0x00010000

Definition at line 98 of file avr32_eth_driver.h.


#define MACB_TX_UNDERRUN   0x10000000

Definition at line 96 of file avr32_eth_driver.h.


#define MACB_TX_USED   0x80000000

Definition at line 93 of file avr32_eth_driver.h.


#define MACB_TX_WRAP   0x40000000

Definition at line 94 of file avr32_eth_driver.h.

Function Documentation

◆ avr32EthDisableIrq()

void avr32EthDisableIrq ( NetInterface interface)

Disable interrupts.

[in]interfaceUnderlying network interface

Definition at line 302 of file avr32_eth_driver.c.

◆ avr32EthEnableIrq()

void avr32EthEnableIrq ( NetInterface interface)

Enable interrupts.

[in]interfaceUnderlying network interface

Definition at line 288 of file avr32_eth_driver.c.

◆ avr32EthEventHandler()

void avr32EthEventHandler ( NetInterface interface)

AVR32 Ethernet MAC event handler.

[in]interfaceUnderlying network interface

Definition at line 383 of file avr32_eth_driver.c.

◆ avr32EthInit()

error_t avr32EthInit ( NetInterface interface)

AVR32 Ethernet MAC initialization.

[in]interfaceUnderlying network interface
Error code

Definition at line 117 of file avr32_eth_driver.c.

◆ avr32EthInitBufferDesc()

void avr32EthInitBufferDesc ( NetInterface interface)

Initialize buffer descriptors.

[in]interfaceUnderlying network interface

Definition at line 223 of file avr32_eth_driver.c.

◆ avr32EthInitGpio()

void avr32EthInitGpio ( NetInterface interface)

◆ avr32EthIrqHandler()

bool_t avr32EthIrqHandler ( void  )

AVR32 Ethernet MAC interrupt service routine.

TRUE if a higher priority task must be woken. Else FALSE is returned

Definition at line 333 of file avr32_eth_driver.c.

◆ avr32EthIrqWrapper()

void avr32EthIrqWrapper ( void  )

◆ avr32EthReadPhyReg()

uint16_t avr32EthReadPhyReg ( uint8_t  opcode,
uint8_t  phyAddr,
uint8_t  regAddr 

Read PHY register.

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

Definition at line 742 of file avr32_eth_driver.c.

◆ avr32EthReceivePacket()

error_t avr32EthReceivePacket ( NetInterface interface)

Receive a packet.

[in]interfaceUnderlying network interface
Error code

Definition at line 482 of file avr32_eth_driver.c.

◆ avr32EthSendPacket()

error_t avr32EthSendPacket ( NetInterface interface,
const NetBuffer buffer,
size_t  offset 

Send a packet.

[in]interfaceUnderlying network interface
[in]bufferMulti-part buffer containing the data to send
[in]offsetOffset to the first data byte
Error code

Definition at line 417 of file avr32_eth_driver.c.

◆ avr32EthTick()

void avr32EthTick ( NetInterface interface)

AVR32 Ethernet MAC timer handler.

This routine is periodically called by the TCP/IP stack to handle periodic operations such as polling the link state

[in]interfaceUnderlying network interface

Definition at line 276 of file avr32_eth_driver.c.

◆ avr32EthUpdateMacAddrFilter()

error_t avr32EthUpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

[in]interfaceUnderlying network interface
Error code

Definition at line 596 of file avr32_eth_driver.c.

◆ avr32EthUpdateMacConfig()

error_t avr32EthUpdateMacConfig ( NetInterface interface)

Adjust MAC configuration parameters for proper operation.

[in]interfaceUnderlying network interface
Error code

Definition at line 668 of file avr32_eth_driver.c.

◆ avr32EthWritePhyReg()

void avr32EthWritePhyReg ( uint8_t  opcode,
uint8_t  phyAddr,
uint8_t  regAddr,
uint16_t  data 

Write PHY register.

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

Definition at line 703 of file avr32_eth_driver.c.

Variable Documentation

◆ avr32EthDriver

const NicDriver avr32EthDriver

AVR32 Ethernet MAC driver.

Definition at line 90 of file avr32_eth_driver.c.