ksz8851_driver.c File Reference

KSZ8851 Ethernet controller. More...

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

Go to the source code of this file.

Macros

#define TRACE_LEVEL   NIC_TRACE_LEVEL
 

Functions

error_t ksz8851Init (NetInterface *interface)
 KSZ8851 controller initialization. More...
 
void ksz8851Tick (NetInterface *interface)
 KSZ8851 timer handler. More...
 
void ksz8851EnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void ksz8851DisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
bool_t ksz8851IrqHandler (NetInterface *interface)
 KSZ8851 interrupt service routine. More...
 
void ksz8851EventHandler (NetInterface *interface)
 KSZ8851 event handler. More...
 
error_t ksz8851SendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset)
 Send a packet. More...
 
error_t ksz8851ReceivePacket (NetInterface *interface)
 Receive a packet. More...
 
error_t ksz8851UpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
void ksz8851WriteReg (NetInterface *interface, uint8_t address, uint16_t data)
 Write KSZ8851 register. More...
 
uint16_t ksz8851ReadReg (NetInterface *interface, uint8_t address)
 Read KSZ8851 register. More...
 
void ksz8851WriteFifo (NetInterface *interface, const uint8_t *data, size_t length)
 Write TX FIFO. More...
 
void ksz8851ReadFifo (NetInterface *interface, uint8_t *data, size_t length)
 Read RX FIFO. More...
 
void ksz8851SetBit (NetInterface *interface, uint8_t address, uint16_t mask)
 Set bit field. More...
 
void ksz8851ClearBit (NetInterface *interface, uint8_t address, uint16_t mask)
 Clear bit field. More...
 
uint32_t ksz8851CalcCrc (const void *data, size_t length)
 CRC calculation. More...
 
void ksz8851DumpReg (NetInterface *interface)
 Dump registers for debugging purpose. More...
 

Variables

const NicDriver ksz8851Driver
 KSZ8851 driver. More...
 

Detailed Description

KSZ8851 Ethernet controller.

License

Copyright (C) 2010-2018 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
1.9.0

Definition in file ksz8851_driver.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 30 of file ksz8851_driver.c.

Function Documentation

◆ ksz8851CalcCrc()

uint32_t ksz8851CalcCrc ( 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 773 of file ksz8851_driver.c.

◆ ksz8851ClearBit()

void ksz8851ClearBit ( NetInterface interface,
uint8_t  address,
uint16_t  mask 
)

Clear bit field.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
[in]maskBits to clear in the target register

Definition at line 755 of file ksz8851_driver.c.

◆ ksz8851DisableIrq()

void ksz8851DisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 198 of file ksz8851_driver.c.

◆ ksz8851DumpReg()

void ksz8851DumpReg ( NetInterface interface)

Dump registers for debugging purpose.

Parameters
[in]interfaceUnderlying network interface

Definition at line 807 of file ksz8851_driver.c.

◆ ksz8851EnableIrq()

void ksz8851EnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 186 of file ksz8851_driver.c.

◆ ksz8851EventHandler()

void ksz8851EventHandler ( NetInterface interface)

KSZ8851 event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 283 of file ksz8851_driver.c.

◆ ksz8851Init()

error_t ksz8851Init ( NetInterface interface)

KSZ8851 controller initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 69 of file ksz8851_driver.c.

◆ ksz8851IrqHandler()

bool_t ksz8851IrqHandler ( NetInterface interface)

KSZ8851 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 211 of file ksz8851_driver.c.

◆ ksz8851ReadFifo()

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

Read RX FIFO.

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

Definition at line 675 of file ksz8851_driver.c.

◆ ksz8851ReadReg()

uint16_t ksz8851ReadReg ( NetInterface interface,
uint8_t  address 
)

Read KSZ8851 register.

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

Definition at line 584 of file ksz8851_driver.c.

◆ ksz8851ReceivePacket()

error_t ksz8851ReceivePacket ( NetInterface interface)

Receive a packet.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 429 of file ksz8851_driver.c.

◆ ksz8851SendPacket()

error_t ksz8851SendPacket ( NetInterface interface,
const NetBuffer buffer,
size_t  offset 
)

Send a packet.

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

Definition at line 358 of file ksz8851_driver.c.

◆ ksz8851SetBit()

void ksz8851SetBit ( NetInterface interface,
uint8_t  address,
uint16_t  mask 
)

Set bit field.

Parameters
[in]interfaceUnderlying network interface
[in]addressRegister address
[in]maskBits to set in the target register

Definition at line 737 of file ksz8851_driver.c.

◆ ksz8851Tick()

void ksz8851Tick ( NetInterface interface)

KSZ8851 timer handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 176 of file ksz8851_driver.c.

◆ ksz8851UpdateMacAddrFilter()

error_t ksz8851UpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 483 of file ksz8851_driver.c.

◆ ksz8851WriteFifo()

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

Write TX FIFO.

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

Definition at line 633 of file ksz8851_driver.c.

◆ ksz8851WriteReg()

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

Write KSZ8851 register.

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

Definition at line 540 of file ksz8851_driver.c.

Variable Documentation

◆ ksz8851Driver

const NicDriver ksz8851Driver
Initial value:
=
{
NULL,
NULL,
NULL,
}
void ksz8851DisableIrq(NetInterface *interface)
Disable interrupts.
void ksz8851EventHandler(NetInterface *interface)
KSZ8851 event handler.
#define TRUE
Definition: os_port.h:48
void ksz8851EnableIrq(NetInterface *interface)
Enable interrupts.
error_t ksz8851UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
error_t ksz8851SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset)
Send a packet.
error_t ksz8851Init(NetInterface *interface)
KSZ8851 controller initialization.
#define ETH_MTU
Definition: ethernet.h:82
Ethernet interface.
Definition: nic.h:69
void ksz8851Tick(NetInterface *interface)
KSZ8851 timer handler.
#define FALSE
Definition: os_port.h:44

KSZ8851 driver.

Definition at line 42 of file ksz8851_driver.c.