Webserver+3d print
Embed:
(wiki syntax)
Show/hide line numbers
mk7x_eth.h
Go to the documentation of this file.
00001 /** 00002 * @file mk7x_eth.h 00003 * @brief Freescale Kinetis K70 Ethernet MAC controller 00004 * 00005 * @section License 00006 * 00007 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. 00008 * 00009 * This file is part of CycloneTCP Open. 00010 * 00011 * This program is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU General Public License 00013 * as published by the Free Software Foundation; either version 2 00014 * of the License, or (at your option) any later version. 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software Foundation, 00023 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00024 * 00025 * @author Oryx Embedded SARL (www.oryx-embedded.com) 00026 * @version 1.7.6 00027 **/ 00028 00029 #ifndef _MK7X_ETH_H 00030 #define _MK7X_ETH_H 00031 00032 //Number of TX buffers 00033 #ifndef MK7X_ETH_TX_BUFFER_COUNT 00034 #define MK7X_ETH_TX_BUFFER_COUNT 3 00035 #elif (MK7X_ETH_TX_BUFFER_COUNT < 1) 00036 #error MK7X_ETH_TX_BUFFER_COUNT parameter is not valid 00037 #endif 00038 00039 //TX buffer size 00040 #ifndef MK7X_ETH_TX_BUFFER_SIZE 00041 #define MK7X_ETH_TX_BUFFER_SIZE 1536 00042 #elif (MK7X_ETH_TX_BUFFER_SIZE != 1536) 00043 #error MK7X_ETH_TX_BUFFER_SIZE parameter is not valid 00044 #endif 00045 00046 //Number of RX buffers 00047 #ifndef MK7X_ETH_RX_BUFFER_COUNT 00048 #define MK7X_ETH_RX_BUFFER_COUNT 6 00049 #elif (MK7X_ETH_RX_BUFFER_COUNT < 1) 00050 #error MK7X_ETH_RX_BUFFER_COUNT parameter is not valid 00051 #endif 00052 00053 //RX buffer size 00054 #ifndef MK7X_ETH_RX_BUFFER_SIZE 00055 #define MK7X_ETH_RX_BUFFER_SIZE 1536 00056 #elif (MK7X_ETH_RX_BUFFER_SIZE != 1536) 00057 #error MK7X_ETH_RX_BUFFER_SIZE parameter is not valid 00058 #endif 00059 00060 //Interrupt priority grouping 00061 #ifndef MK7X_ETH_IRQ_PRIORITY_GROUPING 00062 #define MK7X_ETH_IRQ_PRIORITY_GROUPING 3 00063 #elif (MK7X_ETH_IRQ_PRIORITY_GROUPING < 0) 00064 #error MK7X_ETH_IRQ_PRIORITY_GROUPING parameter is not valid 00065 #endif 00066 00067 //Ethernet interrupt group priority 00068 #ifndef MK7X_ETH_IRQ_GROUP_PRIORITY 00069 #define MK7X_ETH_IRQ_GROUP_PRIORITY 12 00070 #elif (MK7X_ETH_IRQ_GROUP_PRIORITY < 0) 00071 #error MK7X_ETH_IRQ_GROUP_PRIORITY parameter is not valid 00072 #endif 00073 00074 //Ethernet interrupt subpriority 00075 #ifndef MK7X_ETH_IRQ_SUB_PRIORITY 00076 #define MK7X_ETH_IRQ_SUB_PRIORITY 0 00077 #elif (MK7X_ETH_IRQ_SUB_PRIORITY < 0) 00078 #error MK7X_ETH_IRQ_SUB_PRIORITY parameter is not valid 00079 #endif 00080 00081 //Enhanced transmit buffer descriptor 00082 #define ENET_TBD0_R 0x8000 00083 #define ENET_TBD0_TO1 0x4000 00084 #define ENET_TBD0_W 0x2000 00085 #define ENET_TBD0_TO2 0x1000 00086 #define ENET_TBD0_L 0x0800 00087 #define ENET_TBD0_TC 0x0400 00088 #define ENET_TBD1_DATA_LENGTH 0xFFFF 00089 #define ENET_TBD2_DATA_POINTER_H 0xFFFF 00090 #define ENET_TBD3_DATA_POINTER_L 0xFFFF 00091 #define ENET_TBD4_INT 0x4000 00092 #define ENET_TBD4_TS 0x2000 00093 #define ENET_TBD4_PINS 0x1000 00094 #define ENET_TBD4_IINS 0x0800 00095 #define ENET_TBD5_TXE 0x8000 00096 #define ENET_TBD5_UE 0x2000 00097 #define ENET_TBD5_EE 0x1000 00098 #define ENET_TBD5_FE 0x0800 00099 #define ENET_TBD5_LCE 0x0400 00100 #define ENET_TBD5_OE 0x0200 00101 #define ENET_TBD5_TSE 0x0100 00102 #define ENET_TBD8_BDU 0x8000 00103 #define ENET_TBD10_TIMESTAMP_H 0xFFFF 00104 #define ENET_TBD11_TIMESTAMP_L 0xFFFF 00105 00106 //Enhanced receive buffer descriptor 00107 #define ENET_RBD0_E 0x8000 00108 #define ENET_RBD0_RO1 0x4000 00109 #define ENET_RBD0_W 0x2000 00110 #define ENET_RBD0_RO2 0x1000 00111 #define ENET_RBD0_L 0x0800 00112 #define ENET_RBD0_M 0x0100 00113 #define ENET_RBD0_BC 0x0080 00114 #define ENET_RBD0_MC 0x0040 00115 #define ENET_RBD0_LG 0x0020 00116 #define ENET_RBD0_NO 0x0010 00117 #define ENET_RBD0_CR 0x0004 00118 #define ENET_RBD0_OV 0x0002 00119 #define ENET_RBD0_TR 0x0001 00120 #define ENET_RBD1_DATA_LENGTH 0xFFFF 00121 #define ENET_RBD2_DATA_POINTER_H 0xFFFF 00122 #define ENET_RBD3_DATA_POINTER_L 0xFFFF 00123 #define ENET_RBD4_ME 0x8000 00124 #define ENET_RBD4_PE 0x0400 00125 #define ENET_RBD4_CE 0x0200 00126 #define ENET_RBD4_UC 0x0100 00127 #define ENET_RBD4_INT 0x0080 00128 #define ENET_RBD5_VPCP 0xE000 00129 #define ENET_RBD5_ICE 0x0020 00130 #define ENET_RBD5_PCR 0x0010 00131 #define ENET_RBD5_VLAN 0x0004 00132 #define ENET_RBD5_IPV6 0x0002 00133 #define ENET_RBD5_FRAG 0x0001 00134 #define ENET_RBD6_HEADER_LENGTH 0xF800 00135 #define ENET_RBD6_PROTOCOL_TYPE 0x00FF 00136 #define ENET_RBD7_PAYLOAD_CHECKSUM 0xFFFF 00137 #define ENET_RBD8_BDU 0x8000 00138 #define ENET_RBD10_TIMESTAMP_H 0xFFFF 00139 #define ENET_RBD11_TIMESTAMP_L 0xFFFF 00140 00141 //Kinetis K7x Ethernet MAC driver 00142 extern const NicDriver mk7xEthDriver; 00143 00144 //Kinetis K7x Ethernet MAC related functions 00145 error_t mk7xEthInit(NetInterface *interface); 00146 void mk7xEthInitGpio(NetInterface *interface); 00147 void mk7xEthInitBufferDesc(NetInterface *interface); 00148 00149 void mk7xEthTick(NetInterface *interface); 00150 00151 void mk7xEthEnableIrq(NetInterface *interface); 00152 void mk7xEthDisableIrq(NetInterface *interface); 00153 void mk7xEthEventHandler(NetInterface *interface); 00154 00155 error_t mk7xEthSendPacket(NetInterface *interface, 00156 const NetBuffer *buffer, size_t offset); 00157 00158 error_t mk7xEthReceivePacket(NetInterface *interface); 00159 00160 error_t mk7xEthSetMulticastFilter(NetInterface *interface); 00161 error_t mk7xEthUpdateMacConfig(NetInterface *interface); 00162 00163 void mk7xEthWritePhyReg(uint8_t phyAddr, uint8_t regAddr, uint16_t data); 00164 uint16_t mk7xEthReadPhyReg(uint8_t phyAddr, uint8_t regAddr); 00165 00166 uint32_t mk7xEthCalcCrc(const void *data, size_t length); 00167 00168 #endif 00169
Generated on Tue Jul 12 2022 17:10:14 by
