str912_eth_driver.h File Reference

STR9 Ethernet MAC driver. More...

#include "core/nic.h"

Go to the source code of this file.

Data Structures

struct  Str912TxDmaDesc
 Transmit DMA descriptor. More...
 
struct  Str912RxDmaDesc
 Receive DMA descriptor. More...
 

Macros

#define STR912_ETH_TX_BUFFER_COUNT   2
 
#define STR912_ETH_TX_BUFFER_SIZE   1536
 
#define STR912_ETH_RX_BUFFER_COUNT   4
 
#define STR912_ETH_RX_BUFFER_SIZE   1536
 
#define STR912_ETH_IRQ_PRIORITY   15
 
#define ENET_SCR_TX_FIFO_SIZE   0xF0000000
 
#define ENET_SCR_TX_IO_DATA_WIDTH   0x0C000000
 
#define ENET_SCR_TX_CHAN_STATUS   0x03000000
 
#define ENET_SCR_RX_FIFO_SIZE   0x00F00000
 
#define ENET_SCR_RX_IO_DATA_WIDTH   0x000C0000
 
#define ENET_SCR_RX_CHAN_STATUS   0x00030000
 
#define ENET_SCR_TX_MAX_BURST_SIZE   0x000000C0
 
#define ENET_SCR_RX_MAX_BURST_SIZE   0x00000030
 
#define ENET_SCR_LOOPB   0x00000002
 
#define ENET_SCR_SRESET   0x00000001
 
#define ENET_IER_TX_CURR_DONE_EN   0x80000000
 
#define ENET_IER_MAC_802_3_INT_EN   0x10000000
 
#define ENET_IER_TX_MERR_INT_EN   0x02000000
 
#define ENET_IER_TX_DONE_EN   0x00800000
 
#define ENET_IER_TX_NEXT_EN   0x00400000
 
#define ENET_IER_TX_TO_EN   0x00080000
 
#define ENET_IER_TX_ENTRY_EN   0x00040000
 
#define ENET_IER_TX_FULL_EN   0x00020000
 
#define ENET_IER_TX_EMPTY_EN   0x00010000
 
#define ENET_IER_RX_CURR_DONE_EN   0x00008000
 
#define ENET_IER_RX_MERR_INT_EN   0x00000200
 
#define ENET_IER_RX_DONE_EN   0x00000080
 
#define ENET_IER_RX_NEXT_EN   0x00000040
 
#define ENET_IER_PACKET_LOST_EN   0x00000020
 
#define ENET_IER_RX_TO_EN   0x00000008
 
#define ENET_IER_RX_ENTRY_EN   0x00000004
 
#define ENET_IER_RX_FULL_EN   0x00000002
 
#define ENET_IER_RX_EMPTY_EN   0x00000001
 
#define ENET_ISR_TX_CURR_DONE   0x80000000
 
#define ENET_ISR_MAC_802_3_INT   0x10000000
 
#define ENET_ISR_TX_MERR_INT   0x02000000
 
#define ENET_ISR_TX_DONE   0x00800000
 
#define ENET_ISR_TX_NEXT   0x00400000
 
#define ENET_ISR_TX_TO   0x00080000
 
#define ENET_ISR_TX_ENTRY   0x00040000
 
#define ENET_ISR_TX_FULL   0x00020000
 
#define ENET_ISR_TX_EMPTY   0x00010000
 
#define ENET_ISR_RX_CURR_DONE   0x00008000
 
#define ENET_ISR_RX_MERR_INT   0x00000200
 
#define ENET_ISR_RX_DONE   0x00000080
 
#define ENET_ISR_RX_NEXT   0x00000040
 
#define ENET_ISR_PACKET_LOST   0x00000020
 
#define ENET_ISR_RX_TO   0x00000008
 
#define ENET_ISR_RX_ENTRY   0x00000004
 
#define ENET_ISR_RX_FULL   0x00000002
 
#define ENET_ISR_RX_EMPTY   0x00000001
 
#define ENET_CCR_SEL_CLK   0x0000000C
 
#define ENET_CCR_SEL_CLK_0   0x00000000
 
#define ENET_CCR_SEL_CLK_1   0x00000004
 
#define ENET_RXSTR_DFETCH_DLY   0x00FFFF00
 
#define ENET_RXSTR_COLL_SEEN   0x00000080
 
#define ENET_RXSTR_RUNT_FRAME   0x00000040
 
#define ENET_RXSTR_FILTER_FAIL   0x00000020
 
#define ENET_RXSTR_START_FETCH   0x00000004
 
#define ENET_RXSTR_DMA_EN   0x00000001
 
#define ENET_RXSTR_DFETCH_DLY_DEFAULT   0x00800000
 
#define ENET_TXSTR_DFETCH_DLY   0x00FFFF00
 
#define ENET_TXSTR_UNDER_RUN   0x00000020
 
#define ENET_TXSTR_START_FETCH   0x00000004
 
#define ENET_TXSTR_DMA_EN   0x00000001
 
#define ENET_TXSTR_DFETCH_DLY_DEFAULT   0x00800000
 
#define ENET_MCR_RA   0x80000000
 
#define ENET_MCR_EN   0x40000000
 
#define ENET_MCR_PS   0x03000000
 
#define ENET_MCR_DRO   0x00800000
 
#define ENET_MCR_LM   0x00600000
 
#define ENET_MCR_FDM   0x00100000
 
#define ENET_MCR_AFM   0x000E0000
 
#define ENET_MCR_PWF   0x00010000
 
#define ENET_MCR_VFM   0x00008000
 
#define ENET_MCR_ELC   0x00001000
 
#define ENET_MCR_DBF   0x00000800
 
#define ENET_MCR_DPR   0x00000400
 
#define ENET_MCR_RVFF   0x00000200
 
#define ENET_MCR_APR   0x00000100
 
#define ENET_MCR_BL   0x000000C0
 
#define ENET_MCR_DCE   0x00000020
 
#define ENET_MCR_RVBE   0x00000010
 
#define ENET_MCR_TE   0x00000008
 
#define ENET_MCR_RE   0x00000004
 
#define ENET_MCR_RCFA   0x00000001
 
#define ENET_MCR_PS_0   0x00000000
 
#define ENET_MCR_PS_1   0x01000000
 
#define ENET_MCR_AFM_0   0x00000000
 
#define ENET_MCR_AFM_1   0x00020000
 
#define ENET_MCR_AFM_2   0x00040000
 
#define ENET_MCR_AFM_3   0x00060000
 
#define ENET_MCR_AFM_4   0x00080000
 
#define ENET_MCR_AFM_5   0x000A0000
 
#define ENET_MCR_AFM_6   0x000C0000
 
#define ENET_MCR_AFM_7   0x000E0000
 
#define ENET_MCR_BL_0   0x00000000
 
#define ENET_MCR_BL_1   0x00000040
 
#define ENET_MCR_BL_2   0x00000080
 
#define ENET_MCR_BL_3   0x000000C0
 
#define ENET_MIIA_PADDR   0x0000F800
 
#define ENET_MIIA_RADDR   0x000007C0
 
#define ENET_MIIA_PR   0x00000004
 
#define ENET_MIIA_WR   0x00000002
 
#define ENET_MIIA_BUSY   0x00000001
 
#define ENET_MIID_RDATA   0x0000FFFF
 
#define ENET_TDES_CTRL_DLY_EN   0x00008000
 
#define ENET_TDES_CTRL_NXT_EN   0x00004000
 
#define ENET_TDES_CTRL_CONT_EN   0x00001000
 
#define ENET_TDES_CTRL_FL   0x00000FFF
 
#define ENET_TDES_START_ADDR   0xFFFFFFFC
 
#define ENET_TDES_START_FIX_ADDR   0x00000002
 
#define ENET_TDES_START_WRAP_EN   0x00000001
 
#define ENET_TDES_NEXT_ADDR   0xFFFFFFFC
 
#define ENET_TDES_NEXT_NPOL_EN   0x00000001
 
#define ENET_TDES_STATUS_PR   0x80000000
 
#define ENET_TDES_STATUS_BC   0x7FFC0000
 
#define ENET_TDES_STATUS_VALID   0x00010000
 
#define ENET_TDES_STATUS_CC   0x00003C00
 
#define ENET_TDES_STATUS_LCO   0x00000200
 
#define ENET_TDES_STATUS_DEF   0x00000100
 
#define ENET_TDES_STATUS_UR   0x00000080
 
#define ENET_TDES_STATUS_EC   0x00000040
 
#define ENET_TDES_STATUS_LC   0x00000020
 
#define ENET_TDES_STATUS_ED   0x00000010
 
#define ENET_TDES_STATUS_LOC   0x00000008
 
#define ENET_TDES_STATUS_NC   0x00000004
 
#define ENET_TDES_STATUS_FA   0x00000001
 
#define ENET_RDES_CTRL_DLY_EN   0x00008000
 
#define ENET_RDES_CTRL_NXT_EN   0x00004000
 
#define ENET_RDES_CTRL_CONT_EN   0x00001000
 
#define ENET_RDES_CTRL_FL   0x00000FFF
 
#define ENET_RDES_START_ADDR   0xFFFFFFFC
 
#define ENET_RDES_START_FIX_ADDR   0x00000002
 
#define ENET_RDES_START_WRAP_EN   0x00000001
 
#define ENET_RDES_NEXT_ADDR   0xFFFFFFFC
 
#define ENET_RDES_NEXT_NPOL_EN   0x00000001
 
#define ENET_RDES_STATUS_FA   0x80000000
 
#define ENET_RDES_STATUS_PF   0x40000000
 
#define ENET_RDES_STATUS_FF   0x20000000
 
#define ENET_RDES_STATUS_BF   0x10000000
 
#define ENET_RDES_STATUS_MCF   0x08000000
 
#define ENET_RDES_STATUS_UCF   0x04000000
 
#define ENET_RDES_STATUS_CF   0x02000000
 
#define ENET_RDES_STATUS_LE   0x01000000
 
#define ENET_RDES_STATUS_VL2   0x00800000
 
#define ENET_RDES_STATUS_VL1   0x00400000
 
#define ENET_RDES_STATUS_CE   0x00200000
 
#define ENET_RDES_STATUS_EB   0x00100000
 
#define ENET_RDES_STATUS_ME   0x00080000
 
#define ENET_RDES_STATUS_FT   0x00040000
 
#define ENET_RDES_STATUS_LC   0x00020000
 
#define ENET_RDES_STATUS_VALID   0x00010000
 
#define ENET_RDES_STATUS_RF   0x00008000
 
#define ENET_RDES_STATUS_WT   0x00004000
 
#define ENET_RDES_STATUS_FCI   0x00002000
 
#define ENET_RDES_STATUS_OL   0x00001000
 
#define ENET_RDES_STATUS_FL   0x000007FF
 
#define ENET_RDES_STATUS_ERROR
 

Functions

error_t str912EthInit (NetInterface *interface)
 STR912 Ethernet MAC initialization. More...
 
void str912EthInitGpio (NetInterface *interface)
 GPIO configuration. More...
 
void str912EthInitDmaDesc (NetInterface *interface)
 Initialize DMA descriptor lists. More...
 
void str912EthTick (NetInterface *interface)
 STR912 Ethernet MAC timer handler. More...
 
void str912EthEnableIrq (NetInterface *interface)
 Enable interrupts. More...
 
void str912EthDisableIrq (NetInterface *interface)
 Disable interrupts. More...
 
void str912EthEventHandler (NetInterface *interface)
 STR912 Ethernet MAC event handler. More...
 
error_t str912EthSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
 Send a packet. More...
 
error_t str912EthReceivePacket (NetInterface *interface)
 Receive a packet. More...
 
error_t str912EthUpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
error_t str912EthUpdateMacConfig (NetInterface *interface)
 Adjust MAC configuration parameters for proper operation. More...
 
void str912EthWritePhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
 Write PHY register. More...
 
uint16_t str912EthReadPhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
 Read PHY register. More...
 
uint32_t str912EthCalcCrc (const void *data, size_t length)
 CRC calculation. More...
 

Variables

const NicDriver str912EthDriver
 STR912 Ethernet MAC driver. More...
 

Detailed Description

STR9 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file str912_eth_driver.h.

Macro Definition Documentation

◆ ENET_CCR_SEL_CLK

#define ENET_CCR_SEL_CLK   0x0000000C

Definition at line 125 of file str912_eth_driver.h.

◆ ENET_CCR_SEL_CLK_0

#define ENET_CCR_SEL_CLK_0   0x00000000

Definition at line 127 of file str912_eth_driver.h.

◆ ENET_CCR_SEL_CLK_1

#define ENET_CCR_SEL_CLK_1   0x00000004

Definition at line 128 of file str912_eth_driver.h.

◆ ENET_IER_MAC_802_3_INT_EN

#define ENET_IER_MAC_802_3_INT_EN   0x10000000

Definition at line 86 of file str912_eth_driver.h.

◆ ENET_IER_PACKET_LOST_EN

#define ENET_IER_PACKET_LOST_EN   0x00000020

Definition at line 98 of file str912_eth_driver.h.

◆ ENET_IER_RX_CURR_DONE_EN

#define ENET_IER_RX_CURR_DONE_EN   0x00008000

Definition at line 94 of file str912_eth_driver.h.

◆ ENET_IER_RX_DONE_EN

#define ENET_IER_RX_DONE_EN   0x00000080

Definition at line 96 of file str912_eth_driver.h.

◆ ENET_IER_RX_EMPTY_EN

#define ENET_IER_RX_EMPTY_EN   0x00000001

Definition at line 102 of file str912_eth_driver.h.

◆ ENET_IER_RX_ENTRY_EN

#define ENET_IER_RX_ENTRY_EN   0x00000004

Definition at line 100 of file str912_eth_driver.h.

◆ ENET_IER_RX_FULL_EN

#define ENET_IER_RX_FULL_EN   0x00000002

Definition at line 101 of file str912_eth_driver.h.

◆ ENET_IER_RX_MERR_INT_EN

#define ENET_IER_RX_MERR_INT_EN   0x00000200

Definition at line 95 of file str912_eth_driver.h.

◆ ENET_IER_RX_NEXT_EN

#define ENET_IER_RX_NEXT_EN   0x00000040

Definition at line 97 of file str912_eth_driver.h.

◆ ENET_IER_RX_TO_EN

#define ENET_IER_RX_TO_EN   0x00000008

Definition at line 99 of file str912_eth_driver.h.

◆ ENET_IER_TX_CURR_DONE_EN

#define ENET_IER_TX_CURR_DONE_EN   0x80000000

Definition at line 85 of file str912_eth_driver.h.

◆ ENET_IER_TX_DONE_EN

#define ENET_IER_TX_DONE_EN   0x00800000

Definition at line 88 of file str912_eth_driver.h.

◆ ENET_IER_TX_EMPTY_EN

#define ENET_IER_TX_EMPTY_EN   0x00010000

Definition at line 93 of file str912_eth_driver.h.

◆ ENET_IER_TX_ENTRY_EN

#define ENET_IER_TX_ENTRY_EN   0x00040000

Definition at line 91 of file str912_eth_driver.h.

◆ ENET_IER_TX_FULL_EN

#define ENET_IER_TX_FULL_EN   0x00020000

Definition at line 92 of file str912_eth_driver.h.

◆ ENET_IER_TX_MERR_INT_EN

#define ENET_IER_TX_MERR_INT_EN   0x02000000

Definition at line 87 of file str912_eth_driver.h.

◆ ENET_IER_TX_NEXT_EN

#define ENET_IER_TX_NEXT_EN   0x00400000

Definition at line 89 of file str912_eth_driver.h.

◆ ENET_IER_TX_TO_EN

#define ENET_IER_TX_TO_EN   0x00080000

Definition at line 90 of file str912_eth_driver.h.

◆ ENET_ISR_MAC_802_3_INT

#define ENET_ISR_MAC_802_3_INT   0x10000000

Definition at line 106 of file str912_eth_driver.h.

◆ ENET_ISR_PACKET_LOST

#define ENET_ISR_PACKET_LOST   0x00000020

Definition at line 118 of file str912_eth_driver.h.

◆ ENET_ISR_RX_CURR_DONE

#define ENET_ISR_RX_CURR_DONE   0x00008000

Definition at line 114 of file str912_eth_driver.h.

◆ ENET_ISR_RX_DONE

#define ENET_ISR_RX_DONE   0x00000080

Definition at line 116 of file str912_eth_driver.h.

◆ ENET_ISR_RX_EMPTY

#define ENET_ISR_RX_EMPTY   0x00000001

Definition at line 122 of file str912_eth_driver.h.

◆ ENET_ISR_RX_ENTRY

#define ENET_ISR_RX_ENTRY   0x00000004

Definition at line 120 of file str912_eth_driver.h.

◆ ENET_ISR_RX_FULL

#define ENET_ISR_RX_FULL   0x00000002

Definition at line 121 of file str912_eth_driver.h.

◆ ENET_ISR_RX_MERR_INT

#define ENET_ISR_RX_MERR_INT   0x00000200

Definition at line 115 of file str912_eth_driver.h.

◆ ENET_ISR_RX_NEXT

#define ENET_ISR_RX_NEXT   0x00000040

Definition at line 117 of file str912_eth_driver.h.

◆ ENET_ISR_RX_TO

#define ENET_ISR_RX_TO   0x00000008

Definition at line 119 of file str912_eth_driver.h.

◆ ENET_ISR_TX_CURR_DONE

#define ENET_ISR_TX_CURR_DONE   0x80000000

Definition at line 105 of file str912_eth_driver.h.

◆ ENET_ISR_TX_DONE

#define ENET_ISR_TX_DONE   0x00800000

Definition at line 108 of file str912_eth_driver.h.

◆ ENET_ISR_TX_EMPTY

#define ENET_ISR_TX_EMPTY   0x00010000

Definition at line 113 of file str912_eth_driver.h.

◆ ENET_ISR_TX_ENTRY

#define ENET_ISR_TX_ENTRY   0x00040000

Definition at line 111 of file str912_eth_driver.h.

◆ ENET_ISR_TX_FULL

#define ENET_ISR_TX_FULL   0x00020000

Definition at line 112 of file str912_eth_driver.h.

◆ ENET_ISR_TX_MERR_INT

#define ENET_ISR_TX_MERR_INT   0x02000000

Definition at line 107 of file str912_eth_driver.h.

◆ ENET_ISR_TX_NEXT

#define ENET_ISR_TX_NEXT   0x00400000

Definition at line 109 of file str912_eth_driver.h.

◆ ENET_ISR_TX_TO

#define ENET_ISR_TX_TO   0x00080000

Definition at line 110 of file str912_eth_driver.h.

◆ ENET_MCR_AFM

#define ENET_MCR_AFM   0x000E0000

Definition at line 155 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_0

#define ENET_MCR_AFM_0   0x00000000

Definition at line 173 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_1

#define ENET_MCR_AFM_1   0x00020000

Definition at line 174 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_2

#define ENET_MCR_AFM_2   0x00040000

Definition at line 175 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_3

#define ENET_MCR_AFM_3   0x00060000

Definition at line 176 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_4

#define ENET_MCR_AFM_4   0x00080000

Definition at line 177 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_5

#define ENET_MCR_AFM_5   0x000A0000

Definition at line 178 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_6

#define ENET_MCR_AFM_6   0x000C0000

Definition at line 179 of file str912_eth_driver.h.

◆ ENET_MCR_AFM_7

#define ENET_MCR_AFM_7   0x000E0000

Definition at line 180 of file str912_eth_driver.h.

◆ ENET_MCR_APR

#define ENET_MCR_APR   0x00000100

Definition at line 162 of file str912_eth_driver.h.

◆ ENET_MCR_BL

#define ENET_MCR_BL   0x000000C0

Definition at line 163 of file str912_eth_driver.h.

◆ ENET_MCR_BL_0

#define ENET_MCR_BL_0   0x00000000

Definition at line 182 of file str912_eth_driver.h.

◆ ENET_MCR_BL_1

#define ENET_MCR_BL_1   0x00000040

Definition at line 183 of file str912_eth_driver.h.

◆ ENET_MCR_BL_2

#define ENET_MCR_BL_2   0x00000080

Definition at line 184 of file str912_eth_driver.h.

◆ ENET_MCR_BL_3

#define ENET_MCR_BL_3   0x000000C0

Definition at line 185 of file str912_eth_driver.h.

◆ ENET_MCR_DBF

#define ENET_MCR_DBF   0x00000800

Definition at line 159 of file str912_eth_driver.h.

◆ ENET_MCR_DCE

#define ENET_MCR_DCE   0x00000020

Definition at line 164 of file str912_eth_driver.h.

◆ ENET_MCR_DPR

#define ENET_MCR_DPR   0x00000400

Definition at line 160 of file str912_eth_driver.h.

◆ ENET_MCR_DRO

#define ENET_MCR_DRO   0x00800000

Definition at line 152 of file str912_eth_driver.h.

◆ ENET_MCR_ELC

#define ENET_MCR_ELC   0x00001000

Definition at line 158 of file str912_eth_driver.h.

◆ ENET_MCR_EN

#define ENET_MCR_EN   0x40000000

Definition at line 150 of file str912_eth_driver.h.

◆ ENET_MCR_FDM

#define ENET_MCR_FDM   0x00100000

Definition at line 154 of file str912_eth_driver.h.

◆ ENET_MCR_LM

#define ENET_MCR_LM   0x00600000

Definition at line 153 of file str912_eth_driver.h.

◆ ENET_MCR_PS

#define ENET_MCR_PS   0x03000000

Definition at line 151 of file str912_eth_driver.h.

◆ ENET_MCR_PS_0

#define ENET_MCR_PS_0   0x00000000

Definition at line 170 of file str912_eth_driver.h.

◆ ENET_MCR_PS_1

#define ENET_MCR_PS_1   0x01000000

Definition at line 171 of file str912_eth_driver.h.

◆ ENET_MCR_PWF

#define ENET_MCR_PWF   0x00010000

Definition at line 156 of file str912_eth_driver.h.

◆ ENET_MCR_RA

#define ENET_MCR_RA   0x80000000

Definition at line 149 of file str912_eth_driver.h.

◆ ENET_MCR_RCFA

#define ENET_MCR_RCFA   0x00000001

Definition at line 168 of file str912_eth_driver.h.

◆ ENET_MCR_RE

#define ENET_MCR_RE   0x00000004

Definition at line 167 of file str912_eth_driver.h.

◆ ENET_MCR_RVBE

#define ENET_MCR_RVBE   0x00000010

Definition at line 165 of file str912_eth_driver.h.

◆ ENET_MCR_RVFF

#define ENET_MCR_RVFF   0x00000200

Definition at line 161 of file str912_eth_driver.h.

◆ ENET_MCR_TE

#define ENET_MCR_TE   0x00000008

Definition at line 166 of file str912_eth_driver.h.

◆ ENET_MCR_VFM

#define ENET_MCR_VFM   0x00008000

Definition at line 157 of file str912_eth_driver.h.

◆ ENET_MIIA_BUSY

#define ENET_MIIA_BUSY   0x00000001

Definition at line 192 of file str912_eth_driver.h.

◆ ENET_MIIA_PADDR

#define ENET_MIIA_PADDR   0x0000F800

Definition at line 188 of file str912_eth_driver.h.

◆ ENET_MIIA_PR

#define ENET_MIIA_PR   0x00000004

Definition at line 190 of file str912_eth_driver.h.

◆ ENET_MIIA_RADDR

#define ENET_MIIA_RADDR   0x000007C0

Definition at line 189 of file str912_eth_driver.h.

◆ ENET_MIIA_WR

#define ENET_MIIA_WR   0x00000002

Definition at line 191 of file str912_eth_driver.h.

◆ ENET_MIID_RDATA

#define ENET_MIID_RDATA   0x0000FFFF

Definition at line 195 of file str912_eth_driver.h.

◆ ENET_RDES_CTRL_CONT_EN

#define ENET_RDES_CTRL_CONT_EN   0x00001000

Definition at line 230 of file str912_eth_driver.h.

◆ ENET_RDES_CTRL_DLY_EN

#define ENET_RDES_CTRL_DLY_EN   0x00008000

Definition at line 228 of file str912_eth_driver.h.

◆ ENET_RDES_CTRL_FL

#define ENET_RDES_CTRL_FL   0x00000FFF

Definition at line 231 of file str912_eth_driver.h.

◆ ENET_RDES_CTRL_NXT_EN

#define ENET_RDES_CTRL_NXT_EN   0x00004000

Definition at line 229 of file str912_eth_driver.h.

◆ ENET_RDES_NEXT_ADDR

#define ENET_RDES_NEXT_ADDR   0xFFFFFFFC

Definition at line 239 of file str912_eth_driver.h.

◆ ENET_RDES_NEXT_NPOL_EN

#define ENET_RDES_NEXT_NPOL_EN   0x00000001

Definition at line 240 of file str912_eth_driver.h.

◆ ENET_RDES_START_ADDR

#define ENET_RDES_START_ADDR   0xFFFFFFFC

Definition at line 234 of file str912_eth_driver.h.

◆ ENET_RDES_START_FIX_ADDR

#define ENET_RDES_START_FIX_ADDR   0x00000002

Definition at line 235 of file str912_eth_driver.h.

◆ ENET_RDES_START_WRAP_EN

#define ENET_RDES_START_WRAP_EN   0x00000001

Definition at line 236 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_BF

#define ENET_RDES_STATUS_BF   0x10000000

Definition at line 246 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_CE

#define ENET_RDES_STATUS_CE   0x00200000

Definition at line 253 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_CF

#define ENET_RDES_STATUS_CF   0x02000000

Definition at line 249 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_EB

#define ENET_RDES_STATUS_EB   0x00100000

Definition at line 254 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_ERROR

#define ENET_RDES_STATUS_ERROR
Value:
ENET_RDES_STATUS_LE | ENET_RDES_STATUS_CE | \
ENET_RDES_STATUS_EB | ENET_RDES_STATUS_ME | \
ENET_RDES_STATUS_LC | ENET_RDES_STATUS_RF | \
ENET_RDES_STATUS_WT | ENET_RDES_STATUS_OL)

Definition at line 266 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_FA

#define ENET_RDES_STATUS_FA   0x80000000

Definition at line 243 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_FCI

#define ENET_RDES_STATUS_FCI   0x00002000

Definition at line 261 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_FF

#define ENET_RDES_STATUS_FF   0x20000000

Definition at line 245 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_FL

#define ENET_RDES_STATUS_FL   0x000007FF

Definition at line 263 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_FT

#define ENET_RDES_STATUS_FT   0x00040000

Definition at line 256 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_LC

#define ENET_RDES_STATUS_LC   0x00020000

Definition at line 257 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_LE

#define ENET_RDES_STATUS_LE   0x01000000

Definition at line 250 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_MCF

#define ENET_RDES_STATUS_MCF   0x08000000

Definition at line 247 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_ME

#define ENET_RDES_STATUS_ME   0x00080000

Definition at line 255 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_OL

#define ENET_RDES_STATUS_OL   0x00001000

Definition at line 262 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_PF

#define ENET_RDES_STATUS_PF   0x40000000

Definition at line 244 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_RF

#define ENET_RDES_STATUS_RF   0x00008000

Definition at line 259 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_UCF

#define ENET_RDES_STATUS_UCF   0x04000000

Definition at line 248 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_VALID

#define ENET_RDES_STATUS_VALID   0x00010000

Definition at line 258 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_VL1

#define ENET_RDES_STATUS_VL1   0x00400000

Definition at line 252 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_VL2

#define ENET_RDES_STATUS_VL2   0x00800000

Definition at line 251 of file str912_eth_driver.h.

◆ ENET_RDES_STATUS_WT

#define ENET_RDES_STATUS_WT   0x00004000

Definition at line 260 of file str912_eth_driver.h.

◆ ENET_RXSTR_COLL_SEEN

#define ENET_RXSTR_COLL_SEEN   0x00000080

Definition at line 132 of file str912_eth_driver.h.

◆ ENET_RXSTR_DFETCH_DLY

#define ENET_RXSTR_DFETCH_DLY   0x00FFFF00

Definition at line 131 of file str912_eth_driver.h.

◆ ENET_RXSTR_DFETCH_DLY_DEFAULT

#define ENET_RXSTR_DFETCH_DLY_DEFAULT   0x00800000

Definition at line 138 of file str912_eth_driver.h.

◆ ENET_RXSTR_DMA_EN

#define ENET_RXSTR_DMA_EN   0x00000001

Definition at line 136 of file str912_eth_driver.h.

◆ ENET_RXSTR_FILTER_FAIL

#define ENET_RXSTR_FILTER_FAIL   0x00000020

Definition at line 134 of file str912_eth_driver.h.

◆ ENET_RXSTR_RUNT_FRAME

#define ENET_RXSTR_RUNT_FRAME   0x00000040

Definition at line 133 of file str912_eth_driver.h.

◆ ENET_RXSTR_START_FETCH

#define ENET_RXSTR_START_FETCH   0x00000004

Definition at line 135 of file str912_eth_driver.h.

◆ ENET_SCR_LOOPB

#define ENET_SCR_LOOPB   0x00000002

Definition at line 81 of file str912_eth_driver.h.

◆ ENET_SCR_RX_CHAN_STATUS

#define ENET_SCR_RX_CHAN_STATUS   0x00030000

Definition at line 78 of file str912_eth_driver.h.

◆ ENET_SCR_RX_FIFO_SIZE

#define ENET_SCR_RX_FIFO_SIZE   0x00F00000

Definition at line 76 of file str912_eth_driver.h.

◆ ENET_SCR_RX_IO_DATA_WIDTH

#define ENET_SCR_RX_IO_DATA_WIDTH   0x000C0000

Definition at line 77 of file str912_eth_driver.h.

◆ ENET_SCR_RX_MAX_BURST_SIZE

#define ENET_SCR_RX_MAX_BURST_SIZE   0x00000030

Definition at line 80 of file str912_eth_driver.h.

◆ ENET_SCR_SRESET

#define ENET_SCR_SRESET   0x00000001

Definition at line 82 of file str912_eth_driver.h.

◆ ENET_SCR_TX_CHAN_STATUS

#define ENET_SCR_TX_CHAN_STATUS   0x03000000

Definition at line 75 of file str912_eth_driver.h.

◆ ENET_SCR_TX_FIFO_SIZE

#define ENET_SCR_TX_FIFO_SIZE   0xF0000000

Definition at line 73 of file str912_eth_driver.h.

◆ ENET_SCR_TX_IO_DATA_WIDTH

#define ENET_SCR_TX_IO_DATA_WIDTH   0x0C000000

Definition at line 74 of file str912_eth_driver.h.

◆ ENET_SCR_TX_MAX_BURST_SIZE

#define ENET_SCR_TX_MAX_BURST_SIZE   0x000000C0

Definition at line 79 of file str912_eth_driver.h.

◆ ENET_TDES_CTRL_CONT_EN

#define ENET_TDES_CTRL_CONT_EN   0x00001000

Definition at line 200 of file str912_eth_driver.h.

◆ ENET_TDES_CTRL_DLY_EN

#define ENET_TDES_CTRL_DLY_EN   0x00008000

Definition at line 198 of file str912_eth_driver.h.

◆ ENET_TDES_CTRL_FL

#define ENET_TDES_CTRL_FL   0x00000FFF

Definition at line 201 of file str912_eth_driver.h.

◆ ENET_TDES_CTRL_NXT_EN

#define ENET_TDES_CTRL_NXT_EN   0x00004000

Definition at line 199 of file str912_eth_driver.h.

◆ ENET_TDES_NEXT_ADDR

#define ENET_TDES_NEXT_ADDR   0xFFFFFFFC

Definition at line 209 of file str912_eth_driver.h.

◆ ENET_TDES_NEXT_NPOL_EN

#define ENET_TDES_NEXT_NPOL_EN   0x00000001

Definition at line 210 of file str912_eth_driver.h.

◆ ENET_TDES_START_ADDR

#define ENET_TDES_START_ADDR   0xFFFFFFFC

Definition at line 204 of file str912_eth_driver.h.

◆ ENET_TDES_START_FIX_ADDR

#define ENET_TDES_START_FIX_ADDR   0x00000002

Definition at line 205 of file str912_eth_driver.h.

◆ ENET_TDES_START_WRAP_EN

#define ENET_TDES_START_WRAP_EN   0x00000001

Definition at line 206 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_BC

#define ENET_TDES_STATUS_BC   0x7FFC0000

Definition at line 214 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_CC

#define ENET_TDES_STATUS_CC   0x00003C00

Definition at line 216 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_DEF

#define ENET_TDES_STATUS_DEF   0x00000100

Definition at line 218 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_EC

#define ENET_TDES_STATUS_EC   0x00000040

Definition at line 220 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_ED

#define ENET_TDES_STATUS_ED   0x00000010

Definition at line 222 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_FA

#define ENET_TDES_STATUS_FA   0x00000001

Definition at line 225 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_LC

#define ENET_TDES_STATUS_LC   0x00000020

Definition at line 221 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_LCO

#define ENET_TDES_STATUS_LCO   0x00000200

Definition at line 217 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_LOC

#define ENET_TDES_STATUS_LOC   0x00000008

Definition at line 223 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_NC

#define ENET_TDES_STATUS_NC   0x00000004

Definition at line 224 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_PR

#define ENET_TDES_STATUS_PR   0x80000000

Definition at line 213 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_UR

#define ENET_TDES_STATUS_UR   0x00000080

Definition at line 219 of file str912_eth_driver.h.

◆ ENET_TDES_STATUS_VALID

#define ENET_TDES_STATUS_VALID   0x00010000

Definition at line 215 of file str912_eth_driver.h.

◆ ENET_TXSTR_DFETCH_DLY

#define ENET_TXSTR_DFETCH_DLY   0x00FFFF00

Definition at line 141 of file str912_eth_driver.h.

◆ ENET_TXSTR_DFETCH_DLY_DEFAULT

#define ENET_TXSTR_DFETCH_DLY_DEFAULT   0x00800000

Definition at line 146 of file str912_eth_driver.h.

◆ ENET_TXSTR_DMA_EN

#define ENET_TXSTR_DMA_EN   0x00000001

Definition at line 144 of file str912_eth_driver.h.

◆ ENET_TXSTR_START_FETCH

#define ENET_TXSTR_START_FETCH   0x00000004

Definition at line 143 of file str912_eth_driver.h.

◆ ENET_TXSTR_UNDER_RUN

#define ENET_TXSTR_UNDER_RUN   0x00000020

Definition at line 142 of file str912_eth_driver.h.

◆ STR912_ETH_IRQ_PRIORITY

#define STR912_ETH_IRQ_PRIORITY   15

Definition at line 67 of file str912_eth_driver.h.

◆ STR912_ETH_RX_BUFFER_COUNT

#define STR912_ETH_RX_BUFFER_COUNT   4

Definition at line 53 of file str912_eth_driver.h.

◆ STR912_ETH_RX_BUFFER_SIZE

#define STR912_ETH_RX_BUFFER_SIZE   1536

Definition at line 60 of file str912_eth_driver.h.

◆ STR912_ETH_TX_BUFFER_COUNT

#define STR912_ETH_TX_BUFFER_COUNT   2

Definition at line 39 of file str912_eth_driver.h.

◆ STR912_ETH_TX_BUFFER_SIZE

#define STR912_ETH_TX_BUFFER_SIZE   1536

Definition at line 46 of file str912_eth_driver.h.

Function Documentation

◆ str912EthCalcCrc()

uint32_t str912EthCalcCrc ( 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 798 of file str912_eth_driver.c.

◆ str912EthDisableIrq()

void str912EthDisableIrq ( NetInterface interface)

Disable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 386 of file str912_eth_driver.c.

◆ str912EthEnableIrq()

void str912EthEnableIrq ( NetInterface interface)

Enable interrupts.

Parameters
[in]interfaceUnderlying network interface

Definition at line 358 of file str912_eth_driver.c.

◆ str912EthEventHandler()

void str912EthEventHandler ( NetInterface interface)

STR912 Ethernet MAC event handler.

Parameters
[in]interfaceUnderlying network interface

Definition at line 463 of file str912_eth_driver.c.

◆ str912EthInit()

error_t str912EthInit ( NetInterface interface)

STR912 Ethernet MAC initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 114 of file str912_eth_driver.c.

◆ str912EthInitDmaDesc()

void str912EthInitDmaDesc ( NetInterface interface)

Initialize DMA descriptor lists.

Parameters
[in]interfaceUnderlying network interface

Definition at line 277 of file str912_eth_driver.c.

◆ str912EthInitGpio()

void str912EthInitGpio ( NetInterface interface)

GPIO configuration.

Parameters
[in]interfaceUnderlying network interface

Definition at line 219 of file str912_eth_driver.c.

◆ str912EthReadPhyReg()

uint16_t str912EthReadPhyReg ( uint8_t  opcode,
uint8_t  phyAddr,
uint8_t  regAddr 
)

Read PHY register.

Parameters
[in]opcodeAccess type (2 bits)
[in]phyAddrPHY address (5 bits)
[in]regAddrRegister address (5 bits)
Returns
Register value

Definition at line 754 of file str912_eth_driver.c.

◆ str912EthReceivePacket()

error_t str912EthReceivePacket ( NetInterface interface)

Receive a packet.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 554 of file str912_eth_driver.c.

◆ str912EthSendPacket()

error_t str912EthSendPacket ( 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 498 of file str912_eth_driver.c.

◆ str912EthTick()

void str912EthTick ( NetInterface interface)

STR912 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]interfaceUnderlying network interface

Definition at line 333 of file str912_eth_driver.c.

◆ str912EthUpdateMacAddrFilter()

error_t str912EthUpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 615 of file str912_eth_driver.c.

◆ str912EthUpdateMacConfig()

error_t str912EthUpdateMacConfig ( NetInterface interface)

Adjust MAC configuration parameters for proper operation.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 675 of file str912_eth_driver.c.

◆ str912EthWritePhyReg()

void str912EthWritePhyReg ( uint8_t  opcode,
uint8_t  phyAddr,
uint8_t  regAddr,
uint16_t  data 
)

Write PHY register.

Parameters
[in]opcodeAccess type (2 bits)
[in]phyAddrPHY address (5 bits)
[in]regAddrRegister address (5 bits)
[in]dataRegister value

Definition at line 714 of file str912_eth_driver.c.

Variable Documentation

◆ str912EthDriver

const NicDriver str912EthDriver
extern

STR912 Ethernet MAC driver.

Definition at line 87 of file str912_eth_driver.c.

#define ENET_RDES_STATUS_FA
#define ENET_RDES_STATUS_CE
#define ENET_RDES_STATUS_ME
#define ENET_RDES_STATUS_OL
#define ENET_RDES_STATUS_RF