adin2111_driver.c File Reference

ADIN2111 2-port 10Base-T1L Ethernet switch driver. More...

#include "core/net.h"
#include "drivers/switch/adin2111_driver.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   NIC_TRACE_LEVEL
 

Functions

error_t adin2111Init (NetInterface *interface)
 ADIN2111 controller initialization. More...
 
__weak_func void adin2111InitHook (NetInterface *interface)
 ADIN2111 custom configuration. More...
 
void adin2111Tick (NetInterface *interface)
 ADIN2111 timer handler. More...
 
void adin2111EnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void adin2111DisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
bool_t adin2111IrqHandler (NetInterface *interface)
 ADIN2111 interrupt service routine. More...
 
void adin2111EventHandler (NetInterface *interface)
 ADIN2111 event handler. More...
 
void adin2111LinkChangeEventHandler (NetInterface *interface)
 ADIN2111 link status change event handler. More...
 
error_t adin2111SendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send a packet. More...
 
void adin2111ReceivePacket (NetInterface *interface, uint8_t port)
 Receive a packet. More...
 
error_t adin2111UpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
bool_t adin2111GetLinkState (NetInterface *interface, uint8_t port)
 Get link state. More...
 
void adin2111WriteReg (NetInterface *interface, uint16_t address, uint32_t data)
 Write SPI register. More...
 
uint32_t adin2111ReadReg (NetInterface *interface, uint16_t address)
 Read SPI register. More...
 
void adin2111DumpReg (NetInterface *interface)
 Dump SPI registers for debugging purpose. More...
 
void adin2111WritePhyReg (NetInterface *interface, uint8_t port, uint8_t address, uint16_t data)
 Write PHY register. More...
 
uint16_t adin2111ReadPhyReg (NetInterface *interface, uint8_t port, uint8_t address)
 Read PHY register. More...
 
void adin2111DumpPhyReg (NetInterface *interface, uint8_t port)
 Dump PHY registers for debugging purpose. More...
 
void adin2111WriteMmdReg (NetInterface *interface, uint8_t port, uint8_t devAddr, uint16_t regAddr, uint16_t data)
 Write MMD register. More...
 
uint16_t adin2111ReadMmdReg (NetInterface *interface, uint8_t port, uint8_t devAddr, uint16_t regAddr)
 Read MMD register. More...
 
void adin2111WriteFifo (NetInterface *interface, uint16_t header, const uint8_t *data, size_t length)
 Write TX FIFO. More...
 
void adin2111ReadFifo (NetInterface *interface, uint8_t port, uint16_t *header, uint8_t *data, size_t length)
 Read RX FIFO. More...
 

Variables

const NicDriver adin2111Driver
 ADIN2111 driver. More...
 

Detailed Description

ADIN2111 2-port 10Base-T1L Ethernet switch 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 adin2111_driver.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 32 of file adin2111_driver.c.

Function Documentation

◆ adin2111DisableIrq()

void adin2111DisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 263 of file adin2111_driver.c.

◆ adin2111DumpPhyReg()

void adin2111DumpPhyReg ( NetInterface interface,
uint8_t  port 
)

Dump PHY registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface
[in]portPort number

Definition at line 1011 of file adin2111_driver.c.

◆ adin2111DumpReg()

void adin2111DumpReg ( NetInterface interface)

Dump SPI registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface

Definition at line 915 of file adin2111_driver.c.

◆ adin2111EnableIrq()

void adin2111EnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 248 of file adin2111_driver.c.

◆ adin2111EventHandler()

void adin2111EventHandler ( NetInterface interface)

ADIN2111 event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 383 of file adin2111_driver.c.

◆ adin2111GetLinkState()

bool_t adin2111GetLinkState ( NetInterface interface,
uint8_t  port 
)

Get link state.

Parameters
[in]interfaceUnderlying network interface
[in]portPort number
Returns
Link state

Definition at line 820 of file adin2111_driver.c.

◆ adin2111Init()

error_t adin2111Init ( NetInterface interface)

ADIN2111 controller initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 71 of file adin2111_driver.c.

◆ adin2111InitHook()

__weak_func void adin2111InitHook ( NetInterface interface)

ADIN2111 custom configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 228 of file adin2111_driver.c.

◆ adin2111IrqHandler()

bool_t adin2111IrqHandler ( NetInterface interface)

ADIN2111 interrupt service routine.

Parameters
[in]interfaceUnderlying network interface
Returns
TRUE if a higher priority task must be woken. Else FALSE is returned

Definition at line 279 of file adin2111_driver.c.

◆ adin2111LinkChangeEventHandler()

void adin2111LinkChangeEventHandler ( NetInterface interface)

ADIN2111 link status change event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 479 of file adin2111_driver.c.

◆ adin2111ReadFifo()

void adin2111ReadFifo ( NetInterface interface,
uint8_t  port,
uint16_t *  header,
uint8_t *  data,
size_t  length 
)

Read RX FIFO.

Parameters
[in]interfaceUnderlying network interface
[in]portPort number
[out]headerFrame header
[out]dataBuffer where to store the incoming data
[in]lengthNumber of data to read

Definition at line 1178 of file adin2111_driver.c.

◆ adin2111ReadMmdReg()

uint16_t adin2111ReadMmdReg ( NetInterface interface,
uint8_t  port,
uint8_t  devAddr,
uint16_t  regAddr 
)

Read MMD register.

Parameters
[in]interfaceUnderlying network interface
[in]portPort number
[in]devAddrDevice address
[in]regAddrRegister address
Returns
MMD register value

Definition at line 1086 of file adin2111_driver.c.

◆ adin2111ReadPhyReg()

uint16_t adin2111ReadPhyReg ( NetInterface interface,
uint8_t  port,
uint8_t  address 
)

Read PHY register.

Parameters
[in]interfaceUnderlying network interface
[in]portPort number
[in]addressPHY register address
Returns
Register value

Definition at line 976 of file adin2111_driver.c.

◆ adin2111ReadReg()

uint32_t adin2111ReadReg ( NetInterface interface,
uint16_t  address 
)

Read SPI register.

Parameters
[in]interfaceUnderlying network interface
[in]addressSystem register address
Returns
Register value

Definition at line 882 of file adin2111_driver.c.

◆ adin2111ReceivePacket()

void adin2111ReceivePacket ( NetInterface interface,
uint8_t  port 
)

Receive a packet.

Parameters
[in]portPort number
[in]interfaceUnderlying network interface

Definition at line 682 of file adin2111_driver.c.

◆ adin2111SendPacket()

error_t adin2111SendPacket ( 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 585 of file adin2111_driver.c.

◆ adin2111Tick()

void adin2111Tick ( NetInterface interface)

ADIN2111 timer handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 238 of file adin2111_driver.c.

◆ adin2111UpdateMacAddrFilter()

error_t adin2111UpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 734 of file adin2111_driver.c.

◆ adin2111WriteFifo()

void adin2111WriteFifo ( NetInterface interface,
uint16_t  header,
const uint8_t *  data,
size_t  length 
)

Write TX FIFO.

Parameters
[in]interfaceUnderlying network interface
[in]headerFrame header
[in]dataPointer to the data being written
[in]lengthNumber of data to write

Definition at line 1135 of file adin2111_driver.c.

◆ adin2111WriteMmdReg()

void adin2111WriteMmdReg ( NetInterface interface,
uint8_t  port,
uint8_t  devAddr,
uint16_t  regAddr,
uint16_t  data 
)

Write MMD register.

Parameters
[in]interfaceUnderlying network interface
[in]portPort number
[in]devAddrDevice address
[in]regAddrRegister address
[in]dataMMD register value

Definition at line 1037 of file adin2111_driver.c.

◆ adin2111WritePhyReg()

void adin2111WritePhyReg ( NetInterface interface,
uint8_t  port,
uint8_t  address,
uint16_t  data 
)

Write PHY register.

Parameters
[in]interfaceUnderlying network interface
[in]portPort number
[in]addressPHY register address
[in]dataRegister value

Definition at line 940 of file adin2111_driver.c.

◆ adin2111WriteReg()

void adin2111WriteReg ( NetInterface interface,
uint16_t  address,
uint32_t  data 
)

Write SPI register.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
[in]dataSystem register value

Definition at line 854 of file adin2111_driver.c.

Variable Documentation

◆ adin2111Driver

const NicDriver adin2111Driver
#define TRUE
Definition: os_port.h:50
void adin2111Tick(NetInterface *interface)
ADIN2111 timer handler.
void adin2111DisableIrq(NetInterface *interface)
Disable interrupts.
error_t adin2111Init(NetInterface *interface)
ADIN2111 controller initialization.
#define FALSE
Definition: os_port.h:46
error_t adin2111SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
#define ETH_MTU
Definition: ethernet.h:116
void adin2111EnableIrq(NetInterface *interface)
Enable interrupts.
error_t adin2111UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
void adin2111EventHandler(NetInterface *interface)
ADIN2111 event handler.
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83