w5100_driver.c File Reference

WIZnet W5100 Ethernet controller. More...

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

Go to the source code of this file.

Macros

#define TRACE_LEVEL   NIC_TRACE_LEVEL
 

Functions

error_t w5100Init (NetInterface *interface)
 W5100 controller initialization. More...
 
__weak_func void w5100InitHook (NetInterface *interface)
 W5100 custom configuration. More...
 
__weak_func void w5100Tick (NetInterface *interface)
 W5100 timer handler. More...
 
void w5100EnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void w5100DisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
bool_t w5100IrqHandler (NetInterface *interface)
 W5100 interrupt service routine. More...
 
void w5100EventHandler (NetInterface *interface)
 W5100 event handler. More...
 
error_t w5100SendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send a packet. More...
 
error_t w5100ReceivePacket (NetInterface *interface)
 Receive a packet. More...
 
error_t w5100UpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
void w5100WriteReg8 (NetInterface *interface, uint16_t address, uint8_t data)
 Write 8-bit register. More...
 
uint8_t w5100ReadReg8 (NetInterface *interface, uint16_t address)
 Read 8-bit register. More...
 
void w5100WriteReg16 (NetInterface *interface, uint16_t address, uint16_t data)
 Write 16-bit register. More...
 
uint16_t w5100ReadReg16 (NetInterface *interface, uint16_t address)
 Read 16-bit register. More...
 
void w5100WriteData (NetInterface *interface, const uint8_t *data, size_t length)
 Write data. More...
 
void w5100ReadData (NetInterface *interface, uint8_t *data, size_t length)
 Read data. More...
 
void w5100WriteBuffer (NetInterface *interface, uint16_t address, const uint8_t *data, size_t length)
 Write TX buffer. More...
 
void w5100ReadBuffer (NetInterface *interface, uint16_t address, uint8_t *data, size_t length)
 Read RX buffer. More...
 
void w5100DumpReg (NetInterface *interface)
 Dump registers for debugging purpose. More...
 

Variables

const NicDriver w5100Driver
 W5100 driver. More...
 

Detailed Description

WIZnet W5100 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 w5100_driver.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 32 of file w5100_driver.c.

Function Documentation

◆ w5100DisableIrq()

void w5100DisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 202 of file w5100_driver.c.

◆ w5100DumpReg()

void w5100DumpReg ( NetInterface interface)

Dump registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface

Definition at line 716 of file w5100_driver.c.

◆ w5100EnableIrq()

void w5100EnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 187 of file w5100_driver.c.

◆ w5100EventHandler()

void w5100EventHandler ( NetInterface interface)

W5100 event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 279 of file w5100_driver.c.

◆ w5100Init()

error_t w5100Init ( NetInterface interface)

W5100 controller initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 71 of file w5100_driver.c.

◆ w5100InitHook()

__weak_func void w5100InitHook ( NetInterface interface)

W5100 custom configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 159 of file w5100_driver.c.

◆ w5100IrqHandler()

bool_t w5100IrqHandler ( NetInterface interface)

W5100 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 218 of file w5100_driver.c.

◆ w5100ReadBuffer()

void w5100ReadBuffer ( NetInterface interface,
uint16_t  address,
uint8_t *  data,
size_t  length 
)

Read RX buffer.

Parameters
[in]interfaceUnderlying network interface
[in]addressBuffer address
[out]dataBuffer where to store the incoming data
[in]lengthNumber of data to read

Definition at line 696 of file w5100_driver.c.

◆ w5100ReadData()

void w5100ReadData ( NetInterface interface,
uint8_t *  data,
size_t  length 
)

Read data.

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

Definition at line 607 of file w5100_driver.c.

◆ w5100ReadReg16()

uint16_t w5100ReadReg16 ( NetInterface interface,
uint16_t  address 
)

Read 16-bit register.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
Returns
Register value

Definition at line 507 of file w5100_driver.c.

◆ w5100ReadReg8()

uint8_t w5100ReadReg8 ( NetInterface interface,
uint16_t  address 
)

Read 8-bit register.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
Returns
Register value

Definition at line 459 of file w5100_driver.c.

◆ w5100ReceivePacket()

error_t w5100ReceivePacket ( NetInterface interface)

Receive a packet.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 357 of file w5100_driver.c.

◆ w5100SendPacket()

error_t w5100SendPacket ( 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 304 of file w5100_driver.c.

◆ w5100Tick()

__weak_func void w5100Tick ( NetInterface interface)

W5100 timer handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 169 of file w5100_driver.c.

◆ w5100UpdateMacAddrFilter()

error_t w5100UpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 418 of file w5100_driver.c.

◆ w5100WriteBuffer()

void w5100WriteBuffer ( NetInterface interface,
uint16_t  address,
const uint8_t *  data,
size_t  length 
)

Write TX buffer.

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

Definition at line 673 of file w5100_driver.c.

◆ w5100WriteData()

void w5100WriteData ( NetInterface interface,
const uint8_t *  data,
size_t  length 
)

Write data.

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

Definition at line 541 of file w5100_driver.c.

◆ w5100WriteReg16()

void w5100WriteReg16 ( NetInterface interface,
uint16_t  address,
uint16_t  data 
)

Write 16-bit register.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
[in]dataRegister value

Definition at line 491 of file w5100_driver.c.

◆ w5100WriteReg8()

void w5100WriteReg8 ( NetInterface interface,
uint16_t  address,
uint8_t  data 
)

Write 8-bit register.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
[in]dataRegister value

Definition at line 432 of file w5100_driver.c.

Variable Documentation

◆ w5100Driver

const NicDriver w5100Driver
Initial value:

W5100 driver.

Definition at line 44 of file w5100_driver.c.

#define TRUE
Definition: os_port.h:50
void w5100EventHandler(NetInterface *interface)
W5100 event handler.
Definition: w5100_driver.c:279
void w5100DisableIrq(NetInterface *interface)
Disable interrupts.
Definition: w5100_driver.c:202
error_t w5100UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
Definition: w5100_driver.c:418
__weak_func void w5100Tick(NetInterface *interface)
W5100 timer handler.
Definition: w5100_driver.c:169
#define ETH_MTU
Definition: ethernet.h:116
void w5100EnableIrq(NetInterface *interface)
Enable interrupts.
Definition: w5100_driver.c:187
error_t w5100Init(NetInterface *interface)
W5100 controller initialization.
Definition: w5100_driver.c:71
error_t w5100SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
Definition: w5100_driver.c:304
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83