lan8651_driver.c File Reference

LAN8651 10Base-T1S Ethernet controller. More...

#include "core/net.h"
#include "drivers/eth/lan8651_driver.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   NIC_TRACE_LEVEL
 

Functions

error_t lan8651Init (NetInterface *interface)
 LAN8651 controller initialization. More...
 
__weak_func void lan8651InitHook (NetInterface *interface)
 LAN8651 custom configuration. More...
 
void lan8651Config (NetInterface *interface)
 LAN8651 controller configuration. More...
 
void lan8651Tick (NetInterface *interface)
 LAN8651 timer handler. More...
 
void lan8651EnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void lan8651DisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
bool_t lan8651IrqHandler (NetInterface *interface)
 LAN8651 interrupt service routine. More...
 
void lan8651EventHandler (NetInterface *interface)
 LAN8651 event handler. More...
 
error_t lan8651SendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send a packet. More...
 
error_t lan8651ReceivePacket (NetInterface *interface)
 Receive a packet. More...
 
error_t lan8651UpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
void lan8651WriteReg (NetInterface *interface, uint8_t mms, uint16_t address, uint32_t data)
 Write register. More...
 
uint32_t lan8651ReadReg (NetInterface *interface, uint8_t mms, uint16_t address)
 Read register. More...
 
void lan8651DumpReg (NetInterface *interface, uint8_t mms, uint16_t address, uint_t num)
 Dump registers for debugging purpose. More...
 
void lan8651WriteMmdReg (NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
 Write MMD register. More...
 
uint16_t lan8651ReadMmdReg (NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
 Read MMD register. More...
 
int8_t lan8651ReadIndirectReg (NetInterface *interface, uint8_t address)
 Read indirect register. More...
 
uint32_t lan8651CalcParity (uint32_t data)
 Calculate parity bit over a 32-bit data. More...
 

Variables

const NicDriver lan8651Driver
 LAN8651 driver. More...
 

Detailed Description

LAN8651 10Base-T1S Ethernet controller.

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 lan8651_driver.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 32 of file lan8651_driver.c.

Function Documentation

◆ lan8651CalcParity()

uint32_t lan8651CalcParity ( uint32_t  data)

Calculate parity bit over a 32-bit data.

Parameters
[in]data32-bit bit stream
Returns
Odd parity bit computed over the supplied data

Definition at line 1011 of file lan8651_driver.c.

◆ lan8651Config()

void lan8651Config ( NetInterface interface)

LAN8651 controller configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 189 of file lan8651_driver.c.

◆ lan8651DisableIrq()

void lan8651DisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 348 of file lan8651_driver.c.

◆ lan8651DumpReg()

void lan8651DumpReg ( NetInterface interface,
uint8_t  mms,
uint16_t  address,
uint_t  num 
)

Dump registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface
[in]mmsRegister memory map to access
[in]addressStart address
[in]numNumber of registers to dump

Definition at line 915 of file lan8651_driver.c.

◆ lan8651EnableIrq()

void lan8651EnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 333 of file lan8651_driver.c.

◆ lan8651EventHandler()

void lan8651EventHandler ( NetInterface interface)

LAN8651 event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 380 of file lan8651_driver.c.

◆ lan8651Init()

error_t lan8651Init ( NetInterface interface)

LAN8651 controller initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 71 of file lan8651_driver.c.

◆ lan8651InitHook()

__weak_func void lan8651InitHook ( NetInterface interface)

LAN8651 custom configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 179 of file lan8651_driver.c.

◆ lan8651IrqHandler()

bool_t lan8651IrqHandler ( NetInterface interface)

LAN8651 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 364 of file lan8651_driver.c.

◆ lan8651ReadIndirectReg()

int8_t lan8651ReadIndirectReg ( NetInterface interface,
uint8_t  address 
)

Read indirect register.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
Returns
Indirect register value

Definition at line 994 of file lan8651_driver.c.

◆ lan8651ReadMmdReg()

uint16_t lan8651ReadMmdReg ( NetInterface interface,
uint8_t  devAddr,
uint16_t  regAddr 
)

Read MMD register.

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

Definition at line 968 of file lan8651_driver.c.

◆ lan8651ReadReg()

uint32_t lan8651ReadReg ( NetInterface interface,
uint8_t  mms,
uint16_t  address 
)

Read register.

Parameters
[in]interfaceUnderlying network interface
[in]mmsRegister memory map to access
[in]addressRegister address
Returns
Register value

Definition at line 857 of file lan8651_driver.c.

◆ lan8651ReceivePacket()

error_t lan8651ReceivePacket ( NetInterface interface)

Receive a packet.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 527 of file lan8651_driver.c.

◆ lan8651SendPacket()

error_t lan8651SendPacket ( 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 408 of file lan8651_driver.c.

◆ lan8651Tick()

void lan8651Tick ( NetInterface interface)

LAN8651 timer handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 286 of file lan8651_driver.c.

◆ lan8651UpdateMacAddrFilter()

error_t lan8651UpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 655 of file lan8651_driver.c.

◆ lan8651WriteMmdReg()

void lan8651WriteMmdReg ( NetInterface interface,
uint8_t  devAddr,
uint16_t  regAddr,
uint16_t  data 
)

Write MMD register.

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

Definition at line 941 of file lan8651_driver.c.

◆ lan8651WriteReg()

void lan8651WriteReg ( NetInterface interface,
uint8_t  mms,
uint16_t  address,
uint32_t  data 
)

Write register.

Parameters
[in]interfaceUnderlying network interface
[in]mmsRegister memory map to access
[in]addressRegister address
[in]dataRegister value

Definition at line 803 of file lan8651_driver.c.

Variable Documentation

◆ lan8651Driver

const NicDriver lan8651Driver
void lan8651EventHandler(NetInterface *interface)
LAN8651 event handler.
error_t lan8651SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
#define TRUE
Definition: os_port.h:50
void lan8651Tick(NetInterface *interface)
LAN8651 timer handler.
#define FALSE
Definition: os_port.h:46
error_t lan8651Init(NetInterface *interface)
LAN8651 controller initialization.
void lan8651EnableIrq(NetInterface *interface)
Enable interrupts.
#define ETH_MTU
Definition: ethernet.h:116
void lan8651DisableIrq(NetInterface *interface)
Disable interrupts.
error_t lan8651UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83