mimxrt1170_eth3_driver.c
Go to the documentation of this file.
1 /**
2  * @file mimxrt1170_eth3_driver.c
3  * @brief NXP i.MX RT1170 Gigabit Ethernet MAC driver (ENET_QOS instance)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
33 
34 //Dependencies
35 #include "fsl_device_registers.h"
36 #include "fsl_gpio.h"
37 #include "fsl_iomuxc.h"
38 #include "core/net.h"
40 #include "debug.h"
41 
42 //Underlying network interface
43 static NetInterface *nicDriverInterface;
44 
45 //IAR EWARM compiler?
46 #if defined(__ICCARM__)
47 
48 //Transmit buffer
49 #pragma data_alignment = 4
50 #pragma location = MIMXRT1170_ETH3_RAM_SECTION
52 //Receive buffer
53 #pragma data_alignment = 4
54 #pragma location = MIMXRT1170_ETH3_RAM_SECTION
56 //Transmit DMA descriptors
57 #pragma data_alignment = 8
58 #pragma location = MIMXRT1170_ETH3_RAM_SECTION
60 //Receive DMA descriptors
61 #pragma data_alignment = 8
62 #pragma location = MIMXRT1170_ETH3_RAM_SECTION
64 
65 //Keil MDK-ARM or GCC compiler?
66 #else
67 
68 //Transmit buffer
70  __attribute__((aligned(4), __section__(MIMXRT1170_ETH3_RAM_SECTION)));
71 //Receive buffer
73  __attribute__((aligned(4), __section__(MIMXRT1170_ETH3_RAM_SECTION)));
74 //Transmit DMA descriptors
76  __attribute__((aligned(8), __section__(MIMXRT1170_ETH3_RAM_SECTION)));
77 //Receive DMA descriptors
79  __attribute__((aligned(8), __section__(MIMXRT1170_ETH3_RAM_SECTION)));
80 
81 #endif
82 
83 //Current transmit descriptor
84 static uint_t txIndex;
85 //Current receive descriptor
86 static uint_t rxIndex;
87 
88 
89 /**
90  * @brief i.MX RT1170 Ethernet MAC driver (ENET_QOS instance)
91  **/
92 
94 {
96  ETH_MTU,
107  TRUE,
108  TRUE,
109  TRUE,
110  FALSE
111 };
112 
113 
114 /**
115  * @brief i.MX RT1170 Ethernet MAC initialization
116  * @param[in] interface Underlying network interface
117  * @return Error code
118  **/
119 
121 {
122  error_t error;
123  uint32_t temp;
124 
125  //Debug message
126  TRACE_INFO("Initializing i.MX RT1170 Ethernet MAC (ENET_QOS)...\r\n");
127 
128  //Save underlying network interface
129  nicDriverInterface = interface;
130 
131  //Enable ENET_QOS peripheral clock
132  CLOCK_EnableClock(kCLOCK_Enet_Qos);
133 
134  //GPIO configuration
135  mimxrt1170Eth3InitGpio(interface);
136 
137  //Perform a software reset
138  ENET_QOS->DMA_MODE |= ENET_QOS_DMA_MODE_SWR_MASK;
139  //Wait for the reset to complete
140  while((ENET_QOS->DMA_MODE & ENET_QOS_DMA_MODE_SWR_MASK) != 0)
141  {
142  }
143 
144  //Adjust MDC clock range depending on CSR frequency
145  ENET_QOS->MAC_MDIO_ADDRESS = ENET_QOS_MAC_MDIO_ADDRESS_CR(7);
146 
147  //Valid Ethernet PHY or switch driver?
148  if(interface->phyDriver != NULL)
149  {
150  //Ethernet PHY initialization
151  error = interface->phyDriver->init(interface);
152  }
153  else if(interface->switchDriver != NULL)
154  {
155  //Ethernet switch initialization
156  error = interface->switchDriver->init(interface);
157  }
158  else
159  {
160  //The interface is not properly configured
161  error = ERROR_FAILURE;
162  }
163 
164  //Any error to report?
165  if(error)
166  {
167  return error;
168  }
169 
170  //Use default MAC configuration
171  ENET_QOS->MAC_CONFIGURATION = ENET_QOS_MAC_CONFIGURATION_GPSLCE_MASK |
172  ENET_QOS_MAC_CONFIGURATION_DO_MASK;
173 
174  //Set the maximum packet size that can be accepted
175  temp = ENET_QOS->MAC_EXT_CONFIGURATION & ~ENET_QOS_MAC_EXT_CONFIGURATION_GPSL_MASK;
176  ENET_QOS->MAC_EXT_CONFIGURATION = temp | MIMXRT1170_ETH3_RX_BUFFER_SIZE;
177 
178  //Configure MAC address filtering
180 
181  //Disable flow control
182  ENET_QOS->MAC_TX_FLOW_CTRL_Q[0] = 0;
183  ENET_QOS->MAC_RX_FLOW_CTRL = 0;
184 
185  //Enable the first RX queue
186  ENET_QOS->MAC_RXQ_CTRL[0] = ENET_QOS_MAC_RXQ_CTRL_RXQ0EN(2);
187 
188  //Configure DMA operating mode
189  ENET_QOS->DMA_MODE = ENET_QOS_DMA_MODE_INTM(0) | ENET_QOS_DMA_MODE_DSPW(0);
190  //Configure system bus mode
191  ENET_QOS->DMA_SYSBUS_MODE |= ENET_QOS_DMA_SYSBUS_MODE_AAL_MASK;
192 
193  //The DMA takes the descriptor table as contiguous
194  ENET_QOS->DMA_CH[0].DMA_CHX_CTRL = ENET_QOS_DMA_CHX_CTRL_DSL(0);
195  //Configure TX features
196  ENET_QOS->DMA_CH[0].DMA_CHX_TX_CTRL = ENET_QOS_DMA_CHX_TX_CTRL_TxPBL(32);
197 
198  //Configure RX features
199  ENET_QOS->DMA_CH[0].DMA_CHX_RX_CTRL = ENET_QOS_DMA_CHX_RX_CTRL_RxPBL(32) |
200  ENET_QOS_DMA_CHX_RX_CTRL_RBSZ_13_y(MIMXRT1170_ETH3_RX_BUFFER_SIZE / 8);
201 
202  //Enable store and forward mode for transmission
203  ENET_QOS->MTL_QUEUE[0].MTL_TXQX_OP_MODE |= ENET_QOS_MTL_TXQX_OP_MODE_TQS(7) |
204  ENET_QOS_MTL_TXQX_OP_MODE_TXQEN(2) | ENET_QOS_MTL_TXQX_OP_MODE_TSF_MASK;
205 
206  //Enable store and forward mode for reception
207  ENET_QOS->MTL_QUEUE[0].MTL_RXQX_OP_MODE |= ENET_QOS_MTL_RXQX_OP_MODE_RQS(7) |
208  ENET_QOS_MTL_RXQX_OP_MODE_RSF_MASK;
209 
210  //Initialize DMA descriptor lists
211  mimxrt1170Eth3InitDmaDesc(interface);
212 
213  //Prevent interrupts from being generated when the statistic counters reach
214  //half their maximum value
215  ENET_QOS->MAC_MMC_TX_INTERRUPT_MASK = 0xFFFFFFFF;
216  ENET_QOS->MAC_MMC_RX_INTERRUPT_MASK = 0xFFFFFFFF;
217  ENET_QOS->MAC_MMC_IPC_RX_INTERRUPT_MASK = 0xFFFFFFFF;
218 
219  //Disable MAC interrupts
220  ENET_QOS->MAC_INTERRUPT_ENABLE = 0;
221 
222  //Enable the desired DMA interrupts
223  ENET_QOS->DMA_CH[0].DMA_CHX_INT_EN = ENET_QOS_DMA_CHX_INT_EN_NIE_MASK |
224  ENET_QOS_DMA_CHX_INT_EN_RIE_MASK | ENET_QOS_DMA_CHX_INT_EN_TIE_MASK;
225 
226  //Set priority grouping (3 bits for pre-emption priority, no bits for subpriority)
227  NVIC_SetPriorityGrouping(MIMXRT1170_ETH3_IRQ_PRIORITY_GROUPING);
228 
229  //Configure ENET_QOS interrupt priority
230  NVIC_SetPriority(ENET_QOS_IRQn, NVIC_EncodePriority(MIMXRT1170_ETH3_IRQ_PRIORITY_GROUPING,
232 
233  //Enable MAC transmission and reception
234  ENET_QOS->MAC_CONFIGURATION |= ENET_QOS_MAC_CONFIGURATION_TE_MASK |
235  ENET_QOS_MAC_CONFIGURATION_RE_MASK;
236 
237  //Enable DMA transmission and reception
238  ENET_QOS->DMA_CH[0].DMA_CHX_TX_CTRL |= ENET_QOS_DMA_CHX_TX_CTRL_ST_MASK;
239  ENET_QOS->DMA_CH[0].DMA_CHX_RX_CTRL |= ENET_QOS_DMA_CHX_RX_CTRL_SR_MASK;
240 
241  //Accept any packets from the upper layer
242  osSetEvent(&interface->nicTxEvent);
243 
244  //Successful initialization
245  return NO_ERROR;
246 }
247 
248 
249 /**
250  * @brief GPIO configuration
251  * @param[in] interface Underlying network interface
252  **/
253 
254 __weak_func void mimxrt1170Eth3InitGpio(NetInterface *interface)
255 {
256 //MIMXRT1170-EVK evaluation board?
257 #if defined(USE_MIMXRT1170_EVK)
258  uint32_t temp;
259  gpio_pin_config_t pinConfig;
260  clock_root_config_t rootConfig = {0};
261 #if 0
262  clock_sys_pll1_config_t sysPll1Config = {0};
263 
264  //Initialize system PLL1
265  sysPll1Config.pllDiv2En = true;
266  CLOCK_InitSysPll1(&sysPll1Config);
267 #endif
268 
269  //Generate 125MHz root clock
270  rootConfig.clockOff = false;
271  rootConfig.mux = kCLOCK_ENET_QOS_ClockRoot_MuxSysPll1Div2;
272  rootConfig.div = 4;
273  CLOCK_SetRootClock(kCLOCK_Root_Enet_Qos, &rootConfig);
274 
275 #if 0
276  //Initialize PLL PFD3 (528*18/24 = 396MHz)
277  CLOCK_InitPfd(kCLOCK_PllSys2, kCLOCK_Pfd3, 24);
278 
279  //Generate 198MHz bus clock
280  rootConfig.clockOff = false;
281  rootConfig.mux = kCLOCK_BUS_ClockRoot_MuxSysPll2Pfd3;
282  rootConfig.div = 2;
283  CLOCK_SetRootClock(kCLOCK_Root_Bus, &rootConfig);
284 #endif
285 
286  //Select RGMII interface mode
287  temp = IOMUXC_GPR->GPR6 & ~IOMUXC_GPR_GPR6_ENET_QOS_INTF_SEL_MASK;
288  IOMUXC_GPR->GPR6 = temp | IOMUXC_GPR_GPR6_ENET_QOS_INTF_SEL(1);
289 
290  //ENET_QOS_TX_CLK is driven by ENET_QOS_CLK_ROOT
291  IOMUXC_GPR->GPR6 |= IOMUXC_GPR_GPR6_ENET_QOS_CLKGEN_EN_MASK;
292  //Enable ENET_QOS_TX_CLK output
293  IOMUXC_GPR->GPR6 |= IOMUXC_GPR_GPR6_ENET_QOS_RGMII_EN_MASK;
294 
295  //Enable IOMUXC clock
296  CLOCK_EnableClock(kCLOCK_Iomuxc);
297 
298  //Configure GPIO_DISP_B1_00 pin as ENET_QOS_RX_EN
299  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_00_ENET_QOS_RX_EN, 0);
300 
301  //Set GPIO_DISP_B1_00 pad properties
302  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_00_ENET_QOS_RX_EN,
303  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
304  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
305  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
306  IOMUXC_SW_PAD_CTL_PAD_PULL(2) |
307  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
308 
309  //Configure GPIO_DISP_B1_01 pin as ENET_QOS_RX_CLK
310  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_01_ENET_QOS_RX_CLK, 0);
311 
312  //Set GPIO_DISP_B1_01 pad properties
313  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_01_ENET_QOS_RX_CLK,
314  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
315  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
316  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
317  IOMUXC_SW_PAD_CTL_PAD_PULL(2) |
318  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
319 
320  //Configure GPIO_DISP_B1_02 pin as ENET_QOS_RX_DATA00
321  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_02_ENET_QOS_RX_DATA00, 0);
322 
323  //Set GPIO_DISP_B1_02 pad properties
324  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_02_ENET_QOS_RX_DATA00,
325  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
326  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
327  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
328  IOMUXC_SW_PAD_CTL_PAD_PULL(2) |
329  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
330 
331  //Configure GPIO_DISP_B1_03 pin as ENET_QOS_RX_DATA01
332  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_03_ENET_QOS_RX_DATA01, 0);
333 
334  //Set GPIO_DISP_B1_03 pad properties
335  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_03_ENET_QOS_RX_DATA01,
336  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
337  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
338  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
339  IOMUXC_SW_PAD_CTL_PAD_PULL(2) |
340  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
341 
342  //Configure GPIO_DISP_B1_04 pin as ENET_QOS_RX_DATA02
343  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_04_ENET_QOS_RX_DATA02, 0);
344 
345  //Set GPIO_DISP_B1_04 pad properties
346  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_04_ENET_QOS_RX_DATA02,
347  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
348  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
349  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
350  IOMUXC_SW_PAD_CTL_PAD_PULL(2) |
351  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
352 
353  //Configure GPIO_DISP_B1_05 pin as ENET_QOS_RX_DATA03
354  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_05_ENET_QOS_RX_DATA03, 0);
355 
356  //Set GPIO_DISP_B1_05 pad properties
357  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_05_ENET_QOS_RX_DATA03,
358  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
359  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
360  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
361  IOMUXC_SW_PAD_CTL_PAD_PULL(2) |
362  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
363 
364  //Configure GPIO_DISP_B1_06 pin as ENET_QOS_TX_DATA03
365  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_06_ENET_QOS_TX_DATA03, 0);
366 
367  //Set GPIO_DISP_B1_06 pad properties
368  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_06_ENET_QOS_TX_DATA03,
369  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
370  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
371  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
372  IOMUXC_SW_PAD_CTL_PAD_PULL(3) |
373  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
374 
375  //Configure GPIO_DISP_B1_07 pin as ENET_QOS_TX_DATA02
376  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_07_ENET_QOS_TX_DATA02, 0);
377 
378  //Set GPIO_DISP_B1_07 pad properties
379  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_07_ENET_QOS_TX_DATA02,
380  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
381  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
382  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
383  IOMUXC_SW_PAD_CTL_PAD_PULL(3) |
384  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
385 
386  //Configure GPIO_DISP_B1_08 pin as ENET_QOS_TX_DATA01
387  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_08_ENET_QOS_TX_DATA01, 0);
388 
389  //Set GPIO_DISP_B1_08 pad properties
390  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_08_ENET_QOS_TX_DATA01,
391  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
392  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
393  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
394  IOMUXC_SW_PAD_CTL_PAD_PULL(3) |
395  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
396 
397  //Configure GPIO_DISP_B1_09 pin as ENET_QOS_TX_DATA00
398  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_09_ENET_QOS_TX_DATA00, 0);
399 
400  //Set GPIO_DISP_B1_09 pad properties
401  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_09_ENET_QOS_TX_DATA00,
402  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
403  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
404  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
405  IOMUXC_SW_PAD_CTL_PAD_PULL(3) |
406  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
407 
408  //Configure GPIO_DISP_B1_10 pin as ENET_QOS_TX_EN
409  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_10_ENET_QOS_TX_EN, 0);
410 
411  //Set GPIO_DISP_B1_10 pad properties
412  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_10_ENET_QOS_TX_EN,
413  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
414  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
415  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
416  IOMUXC_SW_PAD_CTL_PAD_PULL(3) |
417  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
418 
419  //Configure GPIO_DISP_B1_11 pin as ENET_QOS_TX_CLK
420  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B1_11_ENET_QOS_TX_CLK, 0);
421 
422  //Set GPIO_DISP_B1_11 pad properties
423  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B1_11_ENET_QOS_TX_CLK,
424  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
425  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
426  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
427  IOMUXC_SW_PAD_CTL_PAD_PULL(3) |
428  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
429 
430  //Configure GPIO_EMC_B2_19 pin as ENET_QOS_MDC
431  IOMUXC_SetPinMux(IOMUXC_GPIO_EMC_B2_19_ENET_QOS_MDC, 0);
432 
433  //Set GPIO_EMC_B2_19 pad properties
434  IOMUXC_SetPinConfig(IOMUXC_GPIO_EMC_B2_19_ENET_QOS_MDC,
435  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
436  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
437  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
438  IOMUXC_SW_PAD_CTL_PAD_PULL(3) |
439  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
440 
441  //Configure GPIO_EMC_B2_20 pin as ENET_QOS_MDIO
442  IOMUXC_SetPinMux(IOMUXC_GPIO_EMC_B2_20_ENET_QOS_MDIO, 0);
443 
444  //Set GPIO_EMC_B2_20 pad properties
445  IOMUXC_SetPinConfig(IOMUXC_GPIO_EMC_B2_20_ENET_QOS_MDIO,
446  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
447  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
448  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
449  IOMUXC_SW_PAD_CTL_PAD_PULL(1) |
450  IOMUXC_SW_PAD_CTL_PAD_PDRV(0));
451 
452  //Configure GPIO_DISP_B2_13 pin as GPIO11_IO14
453  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B2_13_GPIO11_IO14, 0);
454 
455  //Set GPIO_DISP_B2_13 pad properties
456  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B2_13_GPIO11_IO14,
457  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
458  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
459  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
460  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
461  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
462  IOMUXC_SW_PAD_CTL_PAD_DSE(1) |
463  IOMUXC_SW_PAD_CTL_PAD_SRE(0));
464 
465  //Configure GPIO_DISP_B2_12 pin as GPIO11_IO13
466  IOMUXC_SetPinMux(IOMUXC_GPIO_DISP_B2_12_GPIO11_IO13, 0);
467 
468  //Set GPIO_DISP_B2_12 pad properties
469  IOMUXC_SetPinConfig(IOMUXC_GPIO_DISP_B2_12_GPIO11_IO13,
470  IOMUXC_SW_PAD_CTL_PAD_DWP_LOCK(0) |
471  IOMUXC_SW_PAD_CTL_PAD_DWP(0) |
472  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
473  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
474  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
475  IOMUXC_SW_PAD_CTL_PAD_DSE(1) |
476  IOMUXC_SW_PAD_CTL_PAD_SRE(0));
477 
478  //Configure ENET_QOS_RST as an output
479  pinConfig.direction = kGPIO_DigitalOutput;
480  pinConfig.outputLogic = 0;
481  pinConfig.interruptMode = kGPIO_NoIntmode;
482  GPIO_PinInit(GPIO11, 14, &pinConfig);
483 
484  //Configure ENET_QOS_INT as an input
485  pinConfig.direction = kGPIO_DigitalInput;
486  pinConfig.outputLogic = 0;
487  pinConfig.interruptMode = kGPIO_NoIntmode;
488  GPIO_PinInit(GPIO11, 13, &pinConfig);
489 
490  //Reset PHY transceiver (hard reset)
491  GPIO_PinWrite(GPIO11, 14, 0);
492  sleep(10);
493  GPIO_PinWrite(GPIO11, 14, 1);
494  sleep(10);
495 #endif
496 }
497 
498 
499 /**
500  * @brief Initialize buffer descriptors
501  * @param[in] interface Underlying network interface
502  **/
503 
505 {
506  uint_t i;
507 
508  //Initialize TX DMA descriptor list
509  for(i = 0; i < MIMXRT1170_ETH3_TX_BUFFER_COUNT; i++)
510  {
511  //The descriptor is initially owned by the application
512  txDmaDesc[i].tdes0 = 0;
513  txDmaDesc[i].tdes1 = 0;
514  txDmaDesc[i].tdes2 = 0;
515  txDmaDesc[i].tdes3 = 0;
516  }
517 
518  //Initialize TX descriptor index
519  txIndex = 0;
520 
521  //Initialize RX DMA descriptor list
522  for(i = 0; i < MIMXRT1170_ETH3_RX_BUFFER_COUNT; i++)
523  {
524  //The descriptor is initially owned by the DMA
525  rxDmaDesc[i].rdes0 = (uint32_t) rxBuffer[i];
526  rxDmaDesc[i].rdes1 = 0;
527  rxDmaDesc[i].rdes2 = 0;
529  }
530 
531  //Initialize RX descriptor index
532  rxIndex = 0;
533 
534  //Start location of the TX descriptor list
535  ENET_QOS->DMA_CH[0].DMA_CHX_TXDESC_LIST_ADDR = (uint32_t) &txDmaDesc[0];
536  //Length of the transmit descriptor ring
537  ENET_QOS->DMA_CH[0].DMA_CHX_TXDESC_RING_LENGTH = MIMXRT1170_ETH3_TX_BUFFER_COUNT - 1;
538 
539  //Start location of the RX descriptor list
540  ENET_QOS->DMA_CH[0].DMA_CHX_RXDESC_LIST_ADDR = (uint32_t) &rxDmaDesc[0];
541  //Length of the receive descriptor ring
542  ENET_QOS->DMA_CH[0].DMA_CHX_RXDESC_RING_LENGTH = MIMXRT1170_ETH3_RX_BUFFER_COUNT - 1;
543 }
544 
545 
546 /**
547  * @brief i.MX RT1170 Ethernet MAC timer handler
548  *
549  * This routine is periodically called by the TCP/IP stack to handle periodic
550  * operations such as polling the link state
551  *
552  * @param[in] interface Underlying network interface
553  **/
554 
556 {
557  //Valid Ethernet PHY or switch driver?
558  if(interface->phyDriver != NULL)
559  {
560  //Handle periodic operations
561  interface->phyDriver->tick(interface);
562  }
563  else if(interface->switchDriver != NULL)
564  {
565  //Handle periodic operations
566  interface->switchDriver->tick(interface);
567  }
568  else
569  {
570  //Just for sanity
571  }
572 }
573 
574 
575 /**
576  * @brief Enable interrupts
577  * @param[in] interface Underlying network interface
578  **/
579 
581 {
582  //Enable Ethernet MAC interrupts
583  NVIC_EnableIRQ(ENET_QOS_IRQn);
584 
585  //Valid Ethernet PHY or switch driver?
586  if(interface->phyDriver != NULL)
587  {
588  //Enable Ethernet PHY interrupts
589  interface->phyDriver->enableIrq(interface);
590  }
591  else if(interface->switchDriver != NULL)
592  {
593  //Enable Ethernet switch interrupts
594  interface->switchDriver->enableIrq(interface);
595  }
596  else
597  {
598  //Just for sanity
599  }
600 }
601 
602 
603 /**
604  * @brief Disable interrupts
605  * @param[in] interface Underlying network interface
606  **/
607 
609 {
610  //Disable Ethernet MAC interrupts
611  NVIC_DisableIRQ(ENET_QOS_IRQn);
612 
613  //Valid Ethernet PHY or switch driver?
614  if(interface->phyDriver != NULL)
615  {
616  //Disable Ethernet PHY interrupts
617  interface->phyDriver->disableIrq(interface);
618  }
619  else if(interface->switchDriver != NULL)
620  {
621  //Disable Ethernet switch interrupts
622  interface->switchDriver->disableIrq(interface);
623  }
624  else
625  {
626  //Just for sanity
627  }
628 }
629 
630 
631 /**
632  * @brief Ethernet MAC interrupt
633  **/
634 
636 {
637  bool_t flag;
638  uint32_t status;
639 
640  //Interrupt service routine prologue
641  osEnterIsr();
642 
643  //This flag will be set if a higher priority task must be woken
644  flag = FALSE;
645 
646  //Read DMA status register
647  status = ENET_QOS->DMA_CH[0].DMA_CHX_STAT;
648 
649  //Packet transmitted?
650  if((status & ENET_QOS_DMA_CHX_STAT_TI_MASK) != 0)
651  {
652  //Clear TI interrupt flag
653  ENET_QOS->DMA_CH[0].DMA_CHX_STAT = ENET_QOS_DMA_CHX_STAT_TI_MASK;
654 
655  //Check whether the TX buffer is available for writing
656  if((txDmaDesc[txIndex].tdes3 & ENET_TDES3_OWN) == 0)
657  {
658  //Notify the TCP/IP stack that the transmitter is ready to send
659  flag |= osSetEventFromIsr(&nicDriverInterface->nicTxEvent);
660  }
661  }
662 
663  //Packet received?
664  if((status & ENET_QOS_DMA_CHX_STAT_RI_MASK) != 0)
665  {
666  //Clear RI interrupt flag
667  ENET_QOS->DMA_CH[0].DMA_CHX_STAT = ENET_QOS_DMA_CHX_STAT_RI_MASK;
668 
669  //Set event flag
670  nicDriverInterface->nicEvent = TRUE;
671  //Notify the TCP/IP stack of the event
672  flag |= osSetEventFromIsr(&netEvent);
673  }
674 
675  //Clear NIS interrupt flag
676  ENET_QOS->DMA_CH[0].DMA_CHX_STAT = ENET_QOS_DMA_CHX_STAT_NIS_MASK;
677 
678  //Interrupt service routine epilogue
679  osExitIsr(flag);
680 }
681 
682 
683 /**
684  * @brief i.MX RT1170 Ethernet MAC event handler
685  * @param[in] interface Underlying network interface
686  **/
687 
689 {
690  error_t error;
691 
692  //Process all pending packets
693  do
694  {
695  //Read incoming packet
696  error = mimxrt1170Eth3ReceivePacket(interface);
697 
698  //No more data in the receive buffer?
699  } while(error != ERROR_BUFFER_EMPTY);
700 }
701 
702 
703 /**
704  * @brief Send a packet
705  * @param[in] interface Underlying network interface
706  * @param[in] buffer Multi-part buffer containing the data to send
707  * @param[in] offset Offset to the first data byte
708  * @param[in] ancillary Additional options passed to the stack along with
709  * the packet
710  * @return Error code
711  **/
712 
714  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
715 {
716  static uint32_t temp[MIMXRT1170_ETH3_TX_BUFFER_SIZE / 4];
717  size_t length;
718 
719  //Retrieve the length of the packet
720  length = netBufferGetLength(buffer) - offset;
721 
722  //Check the frame length
724  {
725  //The transmitter can accept another packet
726  osSetEvent(&interface->nicTxEvent);
727  //Report an error
728  return ERROR_INVALID_LENGTH;
729  }
730 
731  //Make sure the current buffer is available for writing
732  if((txDmaDesc[txIndex].tdes3 & ENET_TDES3_OWN) != 0)
733  {
734  return ERROR_FAILURE;
735  }
736 
737  //Copy user data to the transmit buffer
738  netBufferRead(temp, buffer, offset, length);
739  osMemcpy(txBuffer[txIndex], temp, (length + 3) & ~3UL);
740 
741  //Set the start address of the buffer
742  txDmaDesc[txIndex].tdes0 = (uint32_t) txBuffer[txIndex];
743  //Write the number of bytes to send
744  txDmaDesc[txIndex].tdes2 = ENET_TDES2_IOC | (length & ENET_TDES2_B1L);
745  //Give the ownership of the descriptor to the DMA
747 
748  //Data synchronization barrier
749  __DSB();
750 
751  //Clear TBU flag to resume processing
752  ENET_QOS->DMA_CH[0].DMA_CHX_STAT = ENET_QOS_DMA_CHX_STAT_TBU_MASK;
753  //Instruct the DMA to poll the transmit descriptor list
754  ENET_QOS->DMA_CH[0].DMA_CHX_TXDESC_TAIL_PTR = 0;
755 
756  //Increment index and wrap around if necessary
757  if(++txIndex >= MIMXRT1170_ETH3_TX_BUFFER_COUNT)
758  {
759  txIndex = 0;
760  }
761 
762  //Check whether the next buffer is available for writing
763  if((txDmaDesc[txIndex].tdes3 & ENET_TDES3_OWN) == 0)
764  {
765  //The transmitter can accept another packet
766  osSetEvent(&interface->nicTxEvent);
767  }
768 
769  //Data successfully written
770  return NO_ERROR;
771 }
772 
773 
774 /**
775  * @brief Receive a packet
776  * @param[in] interface Underlying network interface
777  * @return Error code
778  **/
779 
781 {
782  static uint32_t temp[MIMXRT1170_ETH3_RX_BUFFER_SIZE / 4];
783  error_t error;
784  size_t n;
785  NetRxAncillary ancillary;
786 
787  //Current buffer available for reading?
788  if((rxDmaDesc[rxIndex].rdes3 & ENET_RDES3_OWN) == 0)
789  {
790  //FD and LD flags should be set
791  if((rxDmaDesc[rxIndex].rdes3 & ENET_RDES3_FD) != 0 &&
792  (rxDmaDesc[rxIndex].rdes3 & ENET_RDES3_LD) != 0)
793  {
794  //Make sure no error occurred
795  if((rxDmaDesc[rxIndex].rdes3 & ENET_RDES3_ES) == 0)
796  {
797  //Retrieve the length of the frame
798  n = rxDmaDesc[rxIndex].rdes3 & ENET_RDES3_PL;
799  //Limit the number of data to read
801 
802  //Copy data from the receive buffer
803  osMemcpy(temp, rxBuffer[rxIndex], (n + 3) & ~3UL);
804 
805  //Additional options can be passed to the stack along with the packet
806  ancillary = NET_DEFAULT_RX_ANCILLARY;
807 
808  //Pass the packet to the upper layer
809  nicProcessPacket(interface, (uint8_t *) temp, n, &ancillary);
810 
811  //Valid packet received
812  error = NO_ERROR;
813  }
814  else
815  {
816  //The received packet contains an error
817  error = ERROR_INVALID_PACKET;
818  }
819  }
820  else
821  {
822  //The packet is not valid
823  error = ERROR_INVALID_PACKET;
824  }
825 
826  //Set the start address of the buffer
827  rxDmaDesc[rxIndex].rdes0 = (uint32_t) rxBuffer[rxIndex];
828  //Give the ownership of the descriptor back to the DMA
830 
831  //Increment index and wrap around if necessary
832  if(++rxIndex >= MIMXRT1170_ETH3_RX_BUFFER_COUNT)
833  {
834  rxIndex = 0;
835  }
836  }
837  else
838  {
839  //No more data in the receive buffer
840  error = ERROR_BUFFER_EMPTY;
841  }
842 
843  //Clear RBU flag to resume processing
844  ENET_QOS->DMA_CH[0].DMA_CHX_STAT = ENET_QOS_DMA_CHX_STAT_RBU_MASK;
845  //Instruct the DMA to poll the receive descriptor list
846  ENET_QOS->DMA_CH[0].DMA_CHX_RXDESC_TAIL_PTR = 0;
847 
848  //Return status code
849  return error;
850 }
851 
852 
853 /**
854  * @brief Configure MAC address filtering
855  * @param[in] interface Underlying network interface
856  * @return Error code
857  **/
858 
860 {
861  uint_t i;
862  uint_t j;
863  MacFilterEntry *entry;
864 
865  //Debug message
866  TRACE_DEBUG("Updating MAC filter...\r\n");
867 
868  //Configure the receive filter
869  ENET_QOS->MAC_PACKET_FILTER = 0;
870 
871  //Set the MAC address of the station
872  ENET_QOS->MAC_ADDRESS[0].LOW = interface->macAddr.w[0] | (interface->macAddr.w[1] << 16);
873  ENET_QOS->MAC_ADDRESS[0].HIGH = interface->macAddr.w[2];
874 
875  //The MAC address filter contains the list of MAC addresses to accept
876  //when receiving an Ethernet frame
877  for(i = 0, j = 1; i < MAC_ADDR_FILTER_SIZE && j < 64; i++)
878  {
879  //Point to the current entry
880  entry = &interface->macAddrFilter[i];
881 
882  //Valid entry?
883  if(entry->refCount > 0)
884  {
885  //When the AE bit is set, the entry is used for perfect filtering
886  ENET_QOS->MAC_ADDRESS[j].LOW = entry->addr.w[0] | (entry->addr.w[1] << 16);
887  ENET_QOS->MAC_ADDRESS[j].HIGH = entry->addr.w[2] | ENET_QOS_HIGH_AE_MASK;
888 
889  //Next entry
890  j++;
891  }
892  }
893 
894  //Clear unused entries
895  while(j < 64)
896  {
897  //When the AE bit is cleared, the entry is ignored
898  ENET_QOS->MAC_ADDRESS[j].LOW = 0;
899  ENET_QOS->MAC_ADDRESS[j].HIGH = 0;
900 
901  //Next entry
902  j++;
903  }
904 
905  //Successful processing
906  return NO_ERROR;
907 }
908 
909 
910 /**
911  * @brief Adjust MAC configuration parameters for proper operation
912  * @param[in] interface Underlying network interface
913  * @return Error code
914  **/
915 
917 {
918  uint32_t config;
919 
920  //Read current MAC configuration
921  config = ENET_QOS->MAC_CONFIGURATION;
922 
923  //1000BASE-T operation mode?
924  if(interface->linkSpeed == NIC_LINK_SPEED_1GBPS)
925  {
926  config &= ~ENET_QOS_MAC_CONFIGURATION_PS_MASK;
927  config &= ~ENET_QOS_MAC_CONFIGURATION_FES_MASK;
928  }
929  //100BASE-TX operation mode?
930  else if(interface->linkSpeed == NIC_LINK_SPEED_100MBPS)
931  {
932  config |= ENET_QOS_MAC_CONFIGURATION_PS_MASK;
933  config |= ENET_QOS_MAC_CONFIGURATION_FES_MASK;
934  }
935  //10BASE-T operation mode?
936  else
937  {
938  config |= ENET_QOS_MAC_CONFIGURATION_PS_MASK;
939  config &= ~ENET_QOS_MAC_CONFIGURATION_FES_MASK;
940  }
941 
942  //Half-duplex or full-duplex mode?
943  if(interface->duplexMode == NIC_FULL_DUPLEX_MODE)
944  {
945  config |= ENET_QOS_MAC_CONFIGURATION_DM_MASK;
946  }
947  else
948  {
949  config &= ~ENET_QOS_MAC_CONFIGURATION_DM_MASK;
950  }
951 
952  //Update MAC configuration register
953  ENET_QOS->MAC_CONFIGURATION = config;
954 
955  //Successful processing
956  return NO_ERROR;
957 }
958 
959 
960 /**
961  * @brief Write PHY register
962  * @param[in] opcode Access type (2 bits)
963  * @param[in] phyAddr PHY address (5 bits)
964  * @param[in] regAddr Register address (5 bits)
965  * @param[in] data Register value
966  **/
967 
968 void mimxrt1170Eth3WritePhyReg(uint8_t opcode, uint8_t phyAddr,
969  uint8_t regAddr, uint16_t data)
970 {
971  uint32_t temp;
972 
973  //Valid opcode?
974  if(opcode == SMI_OPCODE_WRITE)
975  {
976  //Take care not to alter MDC clock configuration
977  temp = ENET_QOS->MAC_MDIO_ADDRESS & ENET_QOS_MAC_MDIO_ADDRESS_CR_MASK;
978 
979  //Set up a write operation
980  temp |= ENET_QOS_MAC_MDIO_ADDRESS_GOC_0_MASK |
981  ENET_QOS_MAC_MDIO_ADDRESS_GB_MASK;
982 
983  //PHY address
984  temp |= ENET_QOS_MAC_MDIO_ADDRESS_PA(phyAddr);
985  //Register address
986  temp |= ENET_QOS_MAC_MDIO_ADDRESS_RDA(regAddr);
987 
988  //Data to be written in the PHY register
989  ENET_QOS->MAC_MDIO_DATA = data & ENET_QOS_MAC_MDIO_DATA_GD_MASK;
990 
991  //Start a write operation
992  ENET_QOS->MAC_MDIO_ADDRESS = temp;
993  //Wait for the write to complete
994  while((ENET_QOS->MAC_MDIO_ADDRESS & ENET_QOS_MAC_MDIO_ADDRESS_GB_MASK) != 0)
995  {
996  }
997  }
998  else
999  {
1000  //The MAC peripheral only supports standard Clause 22 opcodes
1001  }
1002 }
1003 
1004 
1005 /**
1006  * @brief Read PHY register
1007  * @param[in] opcode Access type (2 bits)
1008  * @param[in] phyAddr PHY address (5 bits)
1009  * @param[in] regAddr Register address (5 bits)
1010  * @return Register value
1011  **/
1012 
1013 uint16_t mimxrt1170Eth3ReadPhyReg(uint8_t opcode, uint8_t phyAddr,
1014  uint8_t regAddr)
1015 {
1016  uint16_t data;
1017  uint32_t temp;
1018 
1019  //Valid opcode?
1020  if(opcode == SMI_OPCODE_READ)
1021  {
1022  //Take care not to alter MDC clock configuration
1023  temp = ENET_QOS->MAC_MDIO_ADDRESS & ENET_QOS_MAC_MDIO_ADDRESS_CR_MASK;
1024 
1025  //Set up a read operation
1026  temp |= ENET_QOS_MAC_MDIO_ADDRESS_GOC_1_MASK |
1027  ENET_QOS_MAC_MDIO_ADDRESS_GOC_0_MASK | ENET_QOS_MAC_MDIO_ADDRESS_GB_MASK;
1028 
1029  //PHY address
1030  temp |= ENET_QOS_MAC_MDIO_ADDRESS_PA(phyAddr);
1031  //Register address
1032  temp |= ENET_QOS_MAC_MDIO_ADDRESS_RDA(regAddr);
1033 
1034  //Start a read operation
1035  ENET_QOS->MAC_MDIO_ADDRESS = temp;
1036  //Wait for the read to complete
1037  while((ENET_QOS->MAC_MDIO_ADDRESS & ENET_QOS_MAC_MDIO_ADDRESS_GB_MASK) != 0)
1038  {
1039  }
1040 
1041  //Get register value
1042  data = ENET_QOS->MAC_MDIO_DATA & ENET_QOS_MAC_MDIO_DATA_GD_MASK;
1043  }
1044  else
1045  {
1046  //The MAC peripheral only supports standard Clause 22 opcodes
1047  data = 0;
1048  }
1049 
1050  //Return the value of the PHY register
1051  return data;
1052 }
#define txDmaDesc
#define rxBuffer
#define txBuffer
#define rxDmaDesc
__attribute__((naked))
AVR32 Ethernet MAC interrupt wrapper.
unsigned int uint_t
Definition: compiler_port.h:50
int bool_t
Definition: compiler_port.h:53
Debugging facilities.
#define TRACE_DEBUG(...)
Definition: debug.h:107
#define TRACE_INFO(...)
Definition: debug.h:95
uint8_t n
uint8_t opcode
Definition: dns_common.h:188
error_t
Error codes.
Definition: error.h:43
@ ERROR_BUFFER_EMPTY
Definition: error.h:141
@ NO_ERROR
Success.
Definition: error.h:44
@ ERROR_INVALID_PACKET
Definition: error.h:140
@ ERROR_INVALID_LENGTH
Definition: error.h:111
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define ETH_MTU
Definition: ethernet.h:116
uint8_t data[]
Definition: ethernet.h:222
#define MAC_ADDR_FILTER_SIZE
Definition: ethernet.h:95
#define ENET_RDES3_FD
#define ENET_RDES3_BUF1V
#define ENET_RDES3_LD
#define ENET_TDES3_OWN
#define ENET_RDES3_IOC
#define ENET_TDES3_FD
#define ENET_RDES3_PL
#define ENET_TDES3_LD
#define ENET_RDES3_ES
#define ENET_RDES3_OWN
#define ENET_TDES2_B1L
#define ENET_TDES2_IOC
void mimxrt1170Eth3DisableIrq(NetInterface *interface)
Disable interrupts.
error_t mimxrt1170Eth3UpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.
const NicDriver mimxrt1170Eth3Driver
i.MX RT1170 Ethernet MAC driver (ENET_QOS instance)
__weak_func void mimxrt1170Eth3InitGpio(NetInterface *interface)
GPIO configuration.
void mimxrt1170Eth3WritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
error_t mimxrt1170Eth3Init(NetInterface *interface)
i.MX RT1170 Ethernet MAC initialization
void mimxrt1170Eth3Tick(NetInterface *interface)
i.MX RT1170 Ethernet MAC timer handler
void mimxrt1170Eth3EnableIrq(NetInterface *interface)
Enable interrupts.
void ENET_QOS_IRQHandler(void)
Ethernet MAC interrupt.
void mimxrt1170Eth3InitDmaDesc(NetInterface *interface)
Initialize buffer descriptors.
error_t mimxrt1170Eth3UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
error_t mimxrt1170Eth3SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
uint16_t mimxrt1170Eth3ReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
void mimxrt1170Eth3EventHandler(NetInterface *interface)
i.MX RT1170 Ethernet MAC event handler
error_t mimxrt1170Eth3ReceivePacket(NetInterface *interface)
Receive a packet.
NXP i.MX RT1170 Gigabit Ethernet MAC driver (ENET_QOS instance)
#define MIMXRT1170_ETH3_IRQ_SUB_PRIORITY
#define MIMXRT1170_ETH3_RX_BUFFER_SIZE
#define MIMXRT1170_ETH3_IRQ_PRIORITY_GROUPING
#define MIMXRT1170_ETH3_RX_BUFFER_COUNT
#define MIMXRT1170_ETH3_IRQ_GROUP_PRIORITY
#define MIMXRT1170_ETH3_RAM_SECTION
#define MIMXRT1170_ETH3_TX_BUFFER_COUNT
#define MIMXRT1170_ETH3_TX_BUFFER_SIZE
uint16_t regAddr
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
#define netEvent
Definition: net_legacy.h:196
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
Definition: net_mem.c:297
size_t netBufferRead(void *dest, const NetBuffer *src, size_t srcOffset, size_t length)
Read data from a multi-part buffer.
Definition: net_mem.c:674
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
Definition: net_misc.c:101
#define NetRxAncillary
Definition: net_misc.h:40
#define NetTxAncillary
Definition: net_misc.h:36
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
Definition: nic.c:391
#define SMI_OPCODE_WRITE
Definition: nic.h:66
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83
#define SMI_OPCODE_READ
Definition: nic.h:67
@ NIC_FULL_DUPLEX_MODE
Definition: nic.h:125
@ NIC_LINK_SPEED_100MBPS
Definition: nic.h:112
@ NIC_LINK_SPEED_1GBPS
Definition: nic.h:113
#define osMemcpy(dest, src, length)
Definition: os_port.h:141
#define MIN(a, b)
Definition: os_port.h:63
#define TRUE
Definition: os_port.h:50
#define FALSE
Definition: os_port.h:46
#define sleep(delay)
Definition: os_port.h:301
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
#define osEnterIsr()
#define osExitIsr(flag)
MAC filter table entry.
Definition: ethernet.h:262
MacAddr addr
MAC address.
Definition: ethernet.h:263
uint_t refCount
Reference count for the current entry.
Definition: ethernet.h:264
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
NIC driver.
Definition: nic.h:283
uint8_t length
Definition: tcp.h:368