NXP Kinetis K60/K64/K65/K66 Ethernet MAC driver. More...
Go to the source code of this file.
Macros | |
#define | MK6X_ETH_TX_BUFFER_COUNT 3 |
#define | MK6X_ETH_TX_BUFFER_SIZE 1536 |
#define | MK6X_ETH_RX_BUFFER_COUNT 6 |
#define | MK6X_ETH_RX_BUFFER_SIZE 1536 |
#define | MK6X_ETH_IRQ_PRIORITY_GROUPING 3 |
#define | MK6X_ETH_IRQ_GROUP_PRIORITY 12 |
#define | MK6X_ETH_IRQ_SUB_PRIORITY 0 |
#define | MPU SYSMPU |
#define | MPU_CESR_VLD_MASK SYSMPU_CESR_VLD_MASK |
#define | ENET_TBD0_R 0x8000 |
#define | ENET_TBD0_TO1 0x4000 |
#define | ENET_TBD0_W 0x2000 |
#define | ENET_TBD0_TO2 0x1000 |
#define | ENET_TBD0_L 0x0800 |
#define | ENET_TBD0_TC 0x0400 |
#define | ENET_TBD1_DATA_LENGTH 0xFFFF |
#define | ENET_TBD2_DATA_POINTER_H 0xFFFF |
#define | ENET_TBD3_DATA_POINTER_L 0xFFFF |
#define | ENET_TBD4_INT 0x4000 |
#define | ENET_TBD4_TS 0x2000 |
#define | ENET_TBD4_PINS 0x1000 |
#define | ENET_TBD4_IINS 0x0800 |
#define | ENET_TBD5_TXE 0x8000 |
#define | ENET_TBD5_UE 0x2000 |
#define | ENET_TBD5_EE 0x1000 |
#define | ENET_TBD5_FE 0x0800 |
#define | ENET_TBD5_LCE 0x0400 |
#define | ENET_TBD5_OE 0x0200 |
#define | ENET_TBD5_TSE 0x0100 |
#define | ENET_TBD8_BDU 0x8000 |
#define | ENET_TBD10_TIMESTAMP_H 0xFFFF |
#define | ENET_TBD11_TIMESTAMP_L 0xFFFF |
#define | ENET_RBD0_E 0x8000 |
#define | ENET_RBD0_RO1 0x4000 |
#define | ENET_RBD0_W 0x2000 |
#define | ENET_RBD0_RO2 0x1000 |
#define | ENET_RBD0_L 0x0800 |
#define | ENET_RBD0_M 0x0100 |
#define | ENET_RBD0_BC 0x0080 |
#define | ENET_RBD0_MC 0x0040 |
#define | ENET_RBD0_LG 0x0020 |
#define | ENET_RBD0_NO 0x0010 |
#define | ENET_RBD0_CR 0x0004 |
#define | ENET_RBD0_OV 0x0002 |
#define | ENET_RBD0_TR 0x0001 |
#define | ENET_RBD1_DATA_LENGTH 0xFFFF |
#define | ENET_RBD2_DATA_POINTER_H 0xFFFF |
#define | ENET_RBD3_DATA_POINTER_L 0xFFFF |
#define | ENET_RBD4_ME 0x8000 |
#define | ENET_RBD4_PE 0x0400 |
#define | ENET_RBD4_CE 0x0200 |
#define | ENET_RBD4_UC 0x0100 |
#define | ENET_RBD4_INT 0x0080 |
#define | ENET_RBD5_VPCP 0xE000 |
#define | ENET_RBD5_ICE 0x0020 |
#define | ENET_RBD5_PCR 0x0010 |
#define | ENET_RBD5_VLAN 0x0004 |
#define | ENET_RBD5_IPV6 0x0002 |
#define | ENET_RBD5_FRAG 0x0001 |
#define | ENET_RBD6_HEADER_LENGTH 0xF800 |
#define | ENET_RBD6_PROTOCOL_TYPE 0x00FF |
#define | ENET_RBD7_PAYLOAD_CHECKSUM 0xFFFF |
#define | ENET_RBD8_BDU 0x8000 |
#define | ENET_RBD10_TIMESTAMP_H 0xFFFF |
#define | ENET_RBD11_TIMESTAMP_L 0xFFFF |
Functions | |
error_t | mk6xEthInit (NetInterface *interface) |
Kinetis K6x Ethernet MAC initialization. More... | |
void | mk6xEthInitGpio (NetInterface *interface) |
GPIO configuration. More... | |
void | mk6xEthInitBufferDesc (NetInterface *interface) |
Initialize buffer descriptors. More... | |
void | mk6xEthTick (NetInterface *interface) |
Kinetis K6x Ethernet MAC timer handler. More... | |
void | mk6xEthEnableIrq (NetInterface *interface) |
Enable interrupts. More... | |
void | mk6xEthDisableIrq (NetInterface *interface) |
Disable interrupts. More... | |
void | mk6xEthEventHandler (NetInterface *interface) |
Kinetis K6x Ethernet MAC event handler. More... | |
error_t | mk6xEthSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
Send a packet. More... | |
error_t | mk6xEthReceivePacket (NetInterface *interface) |
Receive a packet. More... | |
error_t | mk6xEthUpdateMacAddrFilter (NetInterface *interface) |
Configure MAC address filtering. More... | |
error_t | mk6xEthUpdateMacConfig (NetInterface *interface) |
Adjust MAC configuration parameters for proper operation. More... | |
void | mk6xEthWritePhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data) |
Write PHY register. More... | |
uint16_t | mk6xEthReadPhyReg (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr) |
Read PHY register. More... | |
uint32_t | mk6xEthCalcCrc (const void *data, size_t length) |
CRC calculation. More... | |
Variables | |
const NicDriver | mk6xEthDriver |
Kinetis K6x Ethernet MAC driver. More... | |
Detailed Description
NXP Kinetis K60/K64/K65/K66 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 mk6x_eth_driver.h.
Macro Definition Documentation
◆ ENET_RBD0_BC
#define ENET_RBD0_BC 0x0080 |
Definition at line 124 of file mk6x_eth_driver.h.
◆ ENET_RBD0_CR
#define ENET_RBD0_CR 0x0004 |
Definition at line 128 of file mk6x_eth_driver.h.
◆ ENET_RBD0_E
#define ENET_RBD0_E 0x8000 |
Definition at line 118 of file mk6x_eth_driver.h.
◆ ENET_RBD0_L
#define ENET_RBD0_L 0x0800 |
Definition at line 122 of file mk6x_eth_driver.h.
◆ ENET_RBD0_LG
#define ENET_RBD0_LG 0x0020 |
Definition at line 126 of file mk6x_eth_driver.h.
◆ ENET_RBD0_M
#define ENET_RBD0_M 0x0100 |
Definition at line 123 of file mk6x_eth_driver.h.
◆ ENET_RBD0_MC
#define ENET_RBD0_MC 0x0040 |
Definition at line 125 of file mk6x_eth_driver.h.
◆ ENET_RBD0_NO
#define ENET_RBD0_NO 0x0010 |
Definition at line 127 of file mk6x_eth_driver.h.
◆ ENET_RBD0_OV
#define ENET_RBD0_OV 0x0002 |
Definition at line 129 of file mk6x_eth_driver.h.
◆ ENET_RBD0_RO1
#define ENET_RBD0_RO1 0x4000 |
Definition at line 119 of file mk6x_eth_driver.h.
◆ ENET_RBD0_RO2
#define ENET_RBD0_RO2 0x1000 |
Definition at line 121 of file mk6x_eth_driver.h.
◆ ENET_RBD0_TR
#define ENET_RBD0_TR 0x0001 |
Definition at line 130 of file mk6x_eth_driver.h.
◆ ENET_RBD0_W
#define ENET_RBD0_W 0x2000 |
Definition at line 120 of file mk6x_eth_driver.h.
◆ ENET_RBD10_TIMESTAMP_H
#define ENET_RBD10_TIMESTAMP_H 0xFFFF |
Definition at line 149 of file mk6x_eth_driver.h.
◆ ENET_RBD11_TIMESTAMP_L
#define ENET_RBD11_TIMESTAMP_L 0xFFFF |
Definition at line 150 of file mk6x_eth_driver.h.
◆ ENET_RBD1_DATA_LENGTH
#define ENET_RBD1_DATA_LENGTH 0xFFFF |
Definition at line 131 of file mk6x_eth_driver.h.
◆ ENET_RBD2_DATA_POINTER_H
#define ENET_RBD2_DATA_POINTER_H 0xFFFF |
Definition at line 132 of file mk6x_eth_driver.h.
◆ ENET_RBD3_DATA_POINTER_L
#define ENET_RBD3_DATA_POINTER_L 0xFFFF |
Definition at line 133 of file mk6x_eth_driver.h.
◆ ENET_RBD4_CE
#define ENET_RBD4_CE 0x0200 |
Definition at line 136 of file mk6x_eth_driver.h.
◆ ENET_RBD4_INT
#define ENET_RBD4_INT 0x0080 |
Definition at line 138 of file mk6x_eth_driver.h.
◆ ENET_RBD4_ME
#define ENET_RBD4_ME 0x8000 |
Definition at line 134 of file mk6x_eth_driver.h.
◆ ENET_RBD4_PE
#define ENET_RBD4_PE 0x0400 |
Definition at line 135 of file mk6x_eth_driver.h.
◆ ENET_RBD4_UC
#define ENET_RBD4_UC 0x0100 |
Definition at line 137 of file mk6x_eth_driver.h.
◆ ENET_RBD5_FRAG
#define ENET_RBD5_FRAG 0x0001 |
Definition at line 144 of file mk6x_eth_driver.h.
◆ ENET_RBD5_ICE
#define ENET_RBD5_ICE 0x0020 |
Definition at line 140 of file mk6x_eth_driver.h.
◆ ENET_RBD5_IPV6
#define ENET_RBD5_IPV6 0x0002 |
Definition at line 143 of file mk6x_eth_driver.h.
◆ ENET_RBD5_PCR
#define ENET_RBD5_PCR 0x0010 |
Definition at line 141 of file mk6x_eth_driver.h.
◆ ENET_RBD5_VLAN
#define ENET_RBD5_VLAN 0x0004 |
Definition at line 142 of file mk6x_eth_driver.h.
◆ ENET_RBD5_VPCP
#define ENET_RBD5_VPCP 0xE000 |
Definition at line 139 of file mk6x_eth_driver.h.
◆ ENET_RBD6_HEADER_LENGTH
#define ENET_RBD6_HEADER_LENGTH 0xF800 |
Definition at line 145 of file mk6x_eth_driver.h.
◆ ENET_RBD6_PROTOCOL_TYPE
#define ENET_RBD6_PROTOCOL_TYPE 0x00FF |
Definition at line 146 of file mk6x_eth_driver.h.
◆ ENET_RBD7_PAYLOAD_CHECKSUM
#define ENET_RBD7_PAYLOAD_CHECKSUM 0xFFFF |
Definition at line 147 of file mk6x_eth_driver.h.
◆ ENET_RBD8_BDU
#define ENET_RBD8_BDU 0x8000 |
Definition at line 148 of file mk6x_eth_driver.h.
◆ ENET_TBD0_L
#define ENET_TBD0_L 0x0800 |
Definition at line 97 of file mk6x_eth_driver.h.
◆ ENET_TBD0_R
#define ENET_TBD0_R 0x8000 |
Definition at line 93 of file mk6x_eth_driver.h.
◆ ENET_TBD0_TC
#define ENET_TBD0_TC 0x0400 |
Definition at line 98 of file mk6x_eth_driver.h.
◆ ENET_TBD0_TO1
#define ENET_TBD0_TO1 0x4000 |
Definition at line 94 of file mk6x_eth_driver.h.
◆ ENET_TBD0_TO2
#define ENET_TBD0_TO2 0x1000 |
Definition at line 96 of file mk6x_eth_driver.h.
◆ ENET_TBD0_W
#define ENET_TBD0_W 0x2000 |
Definition at line 95 of file mk6x_eth_driver.h.
◆ ENET_TBD10_TIMESTAMP_H
#define ENET_TBD10_TIMESTAMP_H 0xFFFF |
Definition at line 114 of file mk6x_eth_driver.h.
◆ ENET_TBD11_TIMESTAMP_L
#define ENET_TBD11_TIMESTAMP_L 0xFFFF |
Definition at line 115 of file mk6x_eth_driver.h.
◆ ENET_TBD1_DATA_LENGTH
#define ENET_TBD1_DATA_LENGTH 0xFFFF |
Definition at line 99 of file mk6x_eth_driver.h.
◆ ENET_TBD2_DATA_POINTER_H
#define ENET_TBD2_DATA_POINTER_H 0xFFFF |
Definition at line 100 of file mk6x_eth_driver.h.
◆ ENET_TBD3_DATA_POINTER_L
#define ENET_TBD3_DATA_POINTER_L 0xFFFF |
Definition at line 101 of file mk6x_eth_driver.h.
◆ ENET_TBD4_IINS
#define ENET_TBD4_IINS 0x0800 |
Definition at line 105 of file mk6x_eth_driver.h.
◆ ENET_TBD4_INT
#define ENET_TBD4_INT 0x4000 |
Definition at line 102 of file mk6x_eth_driver.h.
◆ ENET_TBD4_PINS
#define ENET_TBD4_PINS 0x1000 |
Definition at line 104 of file mk6x_eth_driver.h.
◆ ENET_TBD4_TS
#define ENET_TBD4_TS 0x2000 |
Definition at line 103 of file mk6x_eth_driver.h.
◆ ENET_TBD5_EE
#define ENET_TBD5_EE 0x1000 |
Definition at line 108 of file mk6x_eth_driver.h.
◆ ENET_TBD5_FE
#define ENET_TBD5_FE 0x0800 |
Definition at line 109 of file mk6x_eth_driver.h.
◆ ENET_TBD5_LCE
#define ENET_TBD5_LCE 0x0400 |
Definition at line 110 of file mk6x_eth_driver.h.
◆ ENET_TBD5_OE
#define ENET_TBD5_OE 0x0200 |
Definition at line 111 of file mk6x_eth_driver.h.
◆ ENET_TBD5_TSE
#define ENET_TBD5_TSE 0x0100 |
Definition at line 112 of file mk6x_eth_driver.h.
◆ ENET_TBD5_TXE
#define ENET_TBD5_TXE 0x8000 |
Definition at line 106 of file mk6x_eth_driver.h.
◆ ENET_TBD5_UE
#define ENET_TBD5_UE 0x2000 |
Definition at line 107 of file mk6x_eth_driver.h.
◆ ENET_TBD8_BDU
#define ENET_TBD8_BDU 0x8000 |
Definition at line 113 of file mk6x_eth_driver.h.
◆ MK6X_ETH_IRQ_GROUP_PRIORITY
#define MK6X_ETH_IRQ_GROUP_PRIORITY 12 |
Definition at line 71 of file mk6x_eth_driver.h.
◆ MK6X_ETH_IRQ_PRIORITY_GROUPING
#define MK6X_ETH_IRQ_PRIORITY_GROUPING 3 |
Definition at line 64 of file mk6x_eth_driver.h.
◆ MK6X_ETH_IRQ_SUB_PRIORITY
#define MK6X_ETH_IRQ_SUB_PRIORITY 0 |
Definition at line 78 of file mk6x_eth_driver.h.
◆ MK6X_ETH_RX_BUFFER_COUNT
#define MK6X_ETH_RX_BUFFER_COUNT 6 |
Definition at line 50 of file mk6x_eth_driver.h.
◆ MK6X_ETH_RX_BUFFER_SIZE
#define MK6X_ETH_RX_BUFFER_SIZE 1536 |
Definition at line 57 of file mk6x_eth_driver.h.
◆ MK6X_ETH_TX_BUFFER_COUNT
#define MK6X_ETH_TX_BUFFER_COUNT 3 |
Definition at line 36 of file mk6x_eth_driver.h.
◆ MK6X_ETH_TX_BUFFER_SIZE
#define MK6X_ETH_TX_BUFFER_SIZE 1536 |
Definition at line 43 of file mk6x_eth_driver.h.
◆ MPU
#define MPU SYSMPU |
Definition at line 85 of file mk6x_eth_driver.h.
◆ MPU_CESR_VLD_MASK
#define MPU_CESR_VLD_MASK SYSMPU_CESR_VLD_MASK |
Definition at line 89 of file mk6x_eth_driver.h.
Function Documentation
◆ mk6xEthCalcCrc()
uint32_t mk6xEthCalcCrc | ( | 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 1083 of file mk6x_eth_driver.c.
◆ mk6xEthDisableIrq()
void mk6xEthDisableIrq | ( | NetInterface * | interface | ) |
Disable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 515 of file mk6x_eth_driver.c.
◆ mk6xEthEnableIrq()
void mk6xEthEnableIrq | ( | NetInterface * | interface | ) |
Enable interrupts.
- Parameters
-
[in] interface Underlying network interface
Definition at line 485 of file mk6x_eth_driver.c.
◆ mk6xEthEventHandler()
void mk6xEthEventHandler | ( | NetInterface * | interface | ) |
Kinetis K6x Ethernet MAC event handler.
- Parameters
-
[in] interface Underlying network interface
Definition at line 643 of file mk6x_eth_driver.c.
◆ mk6xEthInit()
error_t mk6xEthInit | ( | NetInterface * | interface | ) |
Kinetis K6x Ethernet MAC initialization.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 114 of file mk6x_eth_driver.c.
◆ mk6xEthInitBufferDesc()
void mk6xEthInitBufferDesc | ( | NetInterface * | interface | ) |
Initialize buffer descriptors.
- Parameters
-
[in] interface Underlying network interface
Definition at line 397 of file mk6x_eth_driver.c.
◆ mk6xEthInitGpio()
void mk6xEthInitGpio | ( | NetInterface * | interface | ) |
GPIO configuration.
- Parameters
-
[in] interface Underlying network interface
Definition at line 247 of file mk6x_eth_driver.c.
◆ mk6xEthReadPhyReg()
uint16_t mk6xEthReadPhyReg | ( | 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 1036 of file mk6x_eth_driver.c.
◆ mk6xEthReceivePacket()
error_t mk6xEthReceivePacket | ( | NetInterface * | interface | ) |
Receive a packet.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 770 of file mk6x_eth_driver.c.
◆ mk6xEthSendPacket()
error_t mk6xEthSendPacket | ( | 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 698 of file mk6x_eth_driver.c.
◆ mk6xEthTick()
void mk6xEthTick | ( | NetInterface * | interface | ) |
Kinetis K6x 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 460 of file mk6x_eth_driver.c.
◆ mk6xEthUpdateMacAddrFilter()
error_t mk6xEthUpdateMacAddrFilter | ( | NetInterface * | interface | ) |
Configure MAC address filtering.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 851 of file mk6x_eth_driver.c.
◆ mk6xEthUpdateMacConfig()
error_t mk6xEthUpdateMacConfig | ( | NetInterface * | interface | ) |
Adjust MAC configuration parameters for proper operation.
- Parameters
-
[in] interface Underlying network interface
- Returns
- Error code
Definition at line 940 of file mk6x_eth_driver.c.
◆ mk6xEthWritePhyReg()
void mk6xEthWritePhyReg | ( | 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 994 of file mk6x_eth_driver.c.
Variable Documentation
◆ mk6xEthDriver
|
extern |
Kinetis K6x Ethernet MAC driver.
Definition at line 87 of file mk6x_eth_driver.c.