Cortus APS3 Ethernet MAC driver. More...
#include "core/nic.h"
Go to the source code of this file.
Data Structures | |
struct | Aps3TxDmaDesc |
TX DMA descriptor. More... | |
struct | Aps3RxDmaDesc |
RX DMA descriptor. More... | |
Functions | |
error_t | aps3EthInit (NetInterface *interface) |
Cortus APS3 Ethernet MAC initialization. More... | |
void | aps3EthInitDmaDesc (NetInterface *interface) |
Initialize DMA descriptor lists. More... | |
void | aps3EthTick (NetInterface *interface) |
Cortus APS3 Ethernet MAC timer handler. More... | |
void | aps3EthEnableIrq (NetInterface *interface) |
Enable interrupts. More... | |
void | aps3EthDisableIrq (NetInterface *interface) |
Disable interrupts. More... | |
void | aps3EthTxIrqHandler (void) __attribute__((noinline)) |
Ethernet MAC transmit interrupt service routine. More... | |
void | aps3EthRxIrqHandler (void) __attribute__((noinline)) |
Ethernet MAC receive interrupt service routine. More... | |
void | aps3EthEventHandler (NetInterface *interface) |
Cortus APS3 Ethernet MAC event handler. More... | |
error_t | aps3EthSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
Send a packet. More... | |
error_t | aps3EthReceivePacket (NetInterface *interface) |
Receive a packet. More... | |
error_t | aps3EthUpdateMacAddrFilter (NetInterface *interface) |
Configure MAC address filtering. More... | |
error_t | aps3EthUpdateMacConfig (NetInterface *interface) |
Adjust MAC configuration parameters for proper operation. More... | |
void | aps3EthWritePhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data) |
Write PHY register. More... | |
uint16_t | aps3EthReadPhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr) |
Read PHY register. More... | |
uint32_t | aps3EthCalcCrc (const void *data, size_t length) |
CRC calculation. More... | |
Variables | |
const NicDriver | aps3EthDriver |
Cortus APS3 Ethernet MAC driver. More... | |
Detailed Description
Cortus APS3 Ethernet MAC 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.
- Version
- 2.4.4
Definition in file aps3_eth_driver.h.
Macro Definition Documentation
◆ APS3_ETH_IRQ_PRIORITY
#define APS3_ETH_IRQ_PRIORITY 0 |
Definition at line 67 of file aps3_eth_driver.h.
◆ APS3_ETH_RX_BUFFER_COUNT
#define APS3_ETH_RX_BUFFER_COUNT 4 |
Definition at line 53 of file aps3_eth_driver.h.
◆ APS3_ETH_RX_BUFFER_SIZE
#define APS3_ETH_RX_BUFFER_SIZE 1536 |
Definition at line 60 of file aps3_eth_driver.h.
◆ APS3_ETH_TX_BUFFER_COUNT
#define APS3_ETH_TX_BUFFER_COUNT 4 |
Definition at line 39 of file aps3_eth_driver.h.
◆ APS3_ETH_TX_BUFFER_SIZE
#define APS3_ETH_TX_BUFFER_SIZE 1536 |
Definition at line 46 of file aps3_eth_driver.h.
◆ RX_DESC_CRC_ERROR
#define RX_DESC_CRC_ERROR 0x0080 |
Definition at line 115 of file aps3_eth_driver.h.
◆ RX_DESC_FRAME_TOO_LONG
#define RX_DESC_FRAME_TOO_LONG 0x0003 |
Definition at line 110 of file aps3_eth_driver.h.
◆ RX_DESC_INVALID_ADDRESS
#define RX_DESC_INVALID_ADDRESS 0x0020 |
Definition at line 113 of file aps3_eth_driver.h.
◆ RX_DESC_LENGTH_FIELD_ERROR
#define RX_DESC_LENGTH_FIELD_ERROR 0x0002 |
Definition at line 109 of file aps3_eth_driver.h.
◆ RX_DESC_MEMORY_ERROR
#define RX_DESC_MEMORY_ERROR 0x0100 |
Definition at line 116 of file aps3_eth_driver.h.
◆ RX_DESC_ODD_NIBBLE_COUNT
#define RX_DESC_ODD_NIBBLE_COUNT 0x0010 |
Definition at line 112 of file aps3_eth_driver.h.
◆ RX_DESC_PHY_ERROR
#define RX_DESC_PHY_ERROR 0x0040 |
Definition at line 114 of file aps3_eth_driver.h.
◆ RX_DESC_RECEIVE_ERROR
#define RX_DESC_RECEIVE_ERROR 0x0001 |
Definition at line 108 of file aps3_eth_driver.h.
◆ RX_DESC_SHORT_FRAME
#define RX_DESC_SHORT_FRAME 0x0004 |
Definition at line 111 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_CRC_ERROR
#define RX_IRQ_MASK_CRC_ERROR 0x0080 |
Definition at line 92 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_FRAME_OVERFLOW
#define RX_IRQ_MASK_FRAME_OVERFLOW 0x1000 |
Definition at line 97 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_FRAME_READY
#define RX_IRQ_MASK_FRAME_READY 0x0400 |
Definition at line 95 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_FRAME_TOO_LONG
#define RX_IRQ_MASK_FRAME_TOO_LONG 0x0004 |
Definition at line 87 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_INVALID_ADDRESS
#define RX_IRQ_MASK_INVALID_ADDRESS 0x0020 |
Definition at line 90 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_LENGTH_FIELD_ERROR
#define RX_IRQ_MASK_LENGTH_FIELD_ERROR 0x0002 |
Definition at line 86 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_MEMORY_ERROR
#define RX_IRQ_MASK_MEMORY_ERROR 0x0100 |
Definition at line 93 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_ODD_NIBBLE_COUNT
#define RX_IRQ_MASK_ODD_NIBBLE_COUNT 0x0010 |
Definition at line 89 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_PHY_ERROR
#define RX_IRQ_MASK_PHY_ERROR 0x0040 |
Definition at line 91 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_RECEIVE_ERROR
#define RX_IRQ_MASK_RECEIVE_ERROR 0x0001 |
Definition at line 85 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_SHORT_FRAME
#define RX_IRQ_MASK_SHORT_FRAME 0x0008 |
Definition at line 88 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_THRESHOLD_REACHED
#define RX_IRQ_MASK_THRESHOLD_REACHED 0x0800 |
Definition at line 96 of file aps3_eth_driver.h.
◆ RX_IRQ_MASK_WAKEUP_ON_LAN
#define RX_IRQ_MASK_WAKEUP_ON_LAN 0x0200 |
Definition at line 94 of file aps3_eth_driver.h.
◆ TX_DESC_EXCESSIVE_COLLISION
#define TX_DESC_EXCESSIVE_COLLISION 0x0003 |
Definition at line 102 of file aps3_eth_driver.h.
◆ TX_DESC_EXCESSIVE_DEFERRAL
#define TX_DESC_EXCESSIVE_DEFERRAL 0x0002 |
Definition at line 101 of file aps3_eth_driver.h.
◆ TX_DESC_FRAME_TOO_LONG
#define TX_DESC_FRAME_TOO_LONG 0x0010 |
Definition at line 104 of file aps3_eth_driver.h.
◆ TX_DESC_LATE_COLLISION
#define TX_DESC_LATE_COLLISION 0x0004 |
Definition at line 103 of file aps3_eth_driver.h.
◆ TX_DESC_MEMORY_ERROR
#define TX_DESC_MEMORY_ERROR 0x0020 |
Definition at line 105 of file aps3_eth_driver.h.
◆ TX_DESC_TRANSMIT_ERROR
#define TX_DESC_TRANSMIT_ERROR 0x0001 |
Definition at line 100 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_EXCESSIVE_COLLISION
#define TX_IRQ_MASK_EXCESSIVE_COLLISION 0x0004 |
Definition at line 75 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_EXCESSIVE_DEFERRAL
#define TX_IRQ_MASK_EXCESSIVE_DEFERRAL 0x0002 |
Definition at line 74 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_FRAME_SENT
#define TX_IRQ_MASK_FRAME_SENT 0x0040 |
Definition at line 79 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_FRAME_TOO_LONG
#define TX_IRQ_MASK_FRAME_TOO_LONG 0x0010 |
Definition at line 77 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_LATE_COLLISION
#define TX_IRQ_MASK_LATE_COLLISION 0x0008 |
Definition at line 76 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_MEMORY_AVAILABLE
#define TX_IRQ_MASK_MEMORY_AVAILABLE 0x0080 |
Definition at line 80 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_MEMORY_EMPTY
#define TX_IRQ_MASK_MEMORY_EMPTY 0x0200 |
Definition at line 82 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_MEMORY_ERROR
#define TX_IRQ_MASK_MEMORY_ERROR 0x0020 |
Definition at line 78 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_THRESHOLD_REACHED
#define TX_IRQ_MASK_THRESHOLD_REACHED 0x0100 |
Definition at line 81 of file aps3_eth_driver.h.
◆ TX_IRQ_MASK_TRANSMIT_ERROR
#define TX_IRQ_MASK_TRANSMIT_ERROR 0x0001 |
Definition at line 73 of file aps3_eth_driver.h.
Function Documentation
◆ aps3EthCalcCrc()
uint32_t aps3EthCalcCrc | ( | const void * | data, |
size_t | length | ||
) |
CRC calculation.
- Parameters
-
[in] data Pointer to the data over which to calculate the CRC [in] length Number of bytes to process
- Returns
- Resulting CRC value
Definition at line 731 of file aps3_eth_driver.c.
◆ aps3EthDisableIrq()
void aps3EthDisableIrq | ( | NetInterface * | interface | ) |
Disable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 307 of file aps3_eth_driver.c.
◆ aps3EthEnableIrq()
void aps3EthEnableIrq | ( | NetInterface * | interface | ) |
Enable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 278 of file aps3_eth_driver.c.
◆ aps3EthEventHandler()
void aps3EthEventHandler | ( | NetInterface * | interface | ) |
Cortus APS3 Ethernet MAC event handler.
- Parameters
-
[in] interface Underlying network interface
Definition at line 396 of file aps3_eth_driver.c.
◆ aps3EthInit()
error_t aps3EthInit | ( | NetInterface * | interface | ) |
Cortus APS3 Ethernet MAC initialization.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 92 of file aps3_eth_driver.c.
◆ aps3EthInitDmaDesc()
void aps3EthInitDmaDesc | ( | NetInterface * | interface | ) |
Initialize DMA descriptor lists.
- Parameters
-
[in] interface Underlying network interface
Definition at line 206 of file aps3_eth_driver.c.
◆ aps3EthReadPhyReg()
uint16_t aps3EthReadPhyReg | ( | uint8_t | opcode, |
uint8_t | phyAddr, | ||
uint8_t | regAddr | ||
) |
Read PHY register.
- Parameters
-
[in] opcode Access type (2 bits) [in] phyAddr PHY address (5 bits) [in] regAddr Register address (5 bits)
- Returns
- Register value
Definition at line 685 of file aps3_eth_driver.c.
◆ aps3EthReceivePacket()
error_t aps3EthReceivePacket | ( | NetInterface * | interface | ) |
Receive a packet.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 489 of file aps3_eth_driver.c.
◆ aps3EthRxIrqHandler()
void aps3EthRxIrqHandler | ( | void | ) |
Ethernet MAC receive interrupt service routine.
Definition at line 368 of file aps3_eth_driver.c.
◆ aps3EthSendPacket()
error_t aps3EthSendPacket | ( | NetInterface * | interface, |
const NetBuffer * | buffer, | ||
size_t | offset, | ||
NetTxAncillary * | ancillary | ||
) |
Send a packet.
- Parameters
-
[in] interface Underlying network interface [in] buffer Multi-part buffer containing the data to send [in] offset Offset to the first data byte [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
Definition at line 428 of file aps3_eth_driver.c.
◆ aps3EthTick()
void aps3EthTick | ( | NetInterface * | interface | ) |
Cortus APS3 Ethernet MAC timer handler.
This routine is periodically called by the TCP/IP stack to handle periodic operations such as polling the link state
- Parameters
-
[in] interface Underlying network interface
Definition at line 253 of file aps3_eth_driver.c.
◆ aps3EthTxIrqHandler()
void aps3EthTxIrqHandler | ( | void | ) |
Ethernet MAC transmit interrupt service routine.
Definition at line 335 of file aps3_eth_driver.c.
◆ aps3EthUpdateMacAddrFilter()
error_t aps3EthUpdateMacAddrFilter | ( | NetInterface * | interface | ) |
Configure MAC address filtering.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 547 of file aps3_eth_driver.c.
◆ aps3EthUpdateMacConfig()
error_t aps3EthUpdateMacConfig | ( | NetInterface * | interface | ) |
Adjust MAC configuration parameters for proper operation.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 612 of file aps3_eth_driver.c.
◆ aps3EthWritePhyReg()
void aps3EthWritePhyReg | ( | uint8_t | opcode, |
uint8_t | phyAddr, | ||
uint8_t | regAddr, | ||
uint16_t | data | ||
) |
Write PHY register.
- Parameters
-
[in] opcode Access type (2 bits) [in] phyAddr PHY address (5 bits) [in] regAddr Register address (5 bits) [in] data Register value
Definition at line 645 of file aps3_eth_driver.c.
Variable Documentation
◆ aps3EthDriver
|
extern |
Cortus APS3 Ethernet MAC driver.
Definition at line 65 of file aps3_eth_driver.c.