mimxrt1060_eth1_driver.c
Go to the documentation of this file.
1 /**
2  * @file mimxrt1060_eth1_driver.c
3  * @brief NXP i.MX RT1060 Ethernet MAC driver (ENET instance)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 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.6.2
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 //TX buffer
49 #pragma data_alignment = 64
50 #pragma location = MIMXRT1060_ETH1_RAM_SECTION
52 //RX buffer
53 #pragma data_alignment = 64
54 #pragma location = MIMXRT1060_ETH1_RAM_SECTION
56 //TX buffer descriptors
57 #pragma data_alignment = 64
58 #pragma location = MIMXRT1060_ETH1_RAM_SECTION
59 static uint32_t txBufferDesc[MIMXRT1060_ETH1_TX_BUFFER_COUNT][8];
60 //RX buffer descriptors
61 #pragma data_alignment = 64
62 #pragma location = MIMXRT1060_ETH1_RAM_SECTION
63 static uint32_t rxBufferDesc[MIMXRT1060_ETH1_RX_BUFFER_COUNT][8];
64 
65 //ARM or GCC compiler?
66 #else
67 
68 //TX buffer
70  __attribute__((aligned(64), __section__(MIMXRT1060_ETH1_RAM_SECTION)));
71 //RX buffer
73  __attribute__((aligned(64), __section__(MIMXRT1060_ETH1_RAM_SECTION)));
74 //TX buffer descriptors
75 static uint32_t txBufferDesc[MIMXRT1060_ETH1_TX_BUFFER_COUNT][8]
76  __attribute__((aligned(64), __section__(MIMXRT1060_ETH1_RAM_SECTION)));
77 //RX buffer descriptors
78 static uint32_t rxBufferDesc[MIMXRT1060_ETH1_RX_BUFFER_COUNT][8]
79  __attribute__((aligned(64), __section__(MIMXRT1060_ETH1_RAM_SECTION)));
80 
81 #endif
82 
83 //TX buffer index
84 static uint_t txBufferIndex;
85 //RX buffer index
86 static uint_t rxBufferIndex;
87 
88 
89 /**
90  * @brief i.MX RT1060 Ethernet MAC driver (ENET instance)
91  **/
92 
94 {
96  ETH_MTU,
107  TRUE,
108  TRUE,
109  TRUE,
110  FALSE
111 };
112 
113 
114 /**
115  * @brief i.MX RT1060 Ethernet MAC initialization
116  * @param[in] interface Underlying network interface
117  * @return Error code
118  **/
119 
121 {
122  error_t error;
123  uint32_t value;
124 
125  //Debug message
126  TRACE_INFO("Initializing i.MX RT1060 Ethernet MAC (ENET)...\r\n");
127 
128  //Save underlying network interface
129  nicDriverInterface = interface;
130 
131  //Enable ENET peripheral clock
132  CLOCK_EnableClock(kCLOCK_Enet);
133 
134  //GPIO configuration
135  mimxrt1060Eth1InitGpio(interface);
136 
137  //Reset ENET module
138  ENET->ECR = ENET_ECR_RESET_MASK;
139  //Wait for the reset to complete
140  while((ENET->ECR & ENET_ECR_RESET_MASK) != 0)
141  {
142  }
143 
144  //Receive control register
145  ENET->RCR = ENET_RCR_MAX_FL(MIMXRT1060_ETH1_RX_BUFFER_SIZE) |
146  ENET_RCR_RMII_MODE_MASK | ENET_RCR_MII_MODE_MASK;
147 
148  //Transmit control register
149  ENET->TCR = 0;
150  //Configure MDC clock frequency
151  ENET->MSCR = ENET_MSCR_HOLDTIME(10) | ENET_MSCR_MII_SPEED(120);
152 
153  //Valid Ethernet PHY or switch driver?
154  if(interface->phyDriver != NULL)
155  {
156  //Ethernet PHY initialization
157  error = interface->phyDriver->init(interface);
158  }
159  else if(interface->switchDriver != NULL)
160  {
161  //Ethernet switch initialization
162  error = interface->switchDriver->init(interface);
163  }
164  else
165  {
166  //The interface is not properly configured
167  error = ERROR_FAILURE;
168  }
169 
170  //Any error to report?
171  if(error)
172  {
173  return error;
174  }
175 
176  //Set the MAC address of the station (upper 16 bits)
177  value = interface->macAddr.b[5];
178  value |= (interface->macAddr.b[4] << 8);
179  ENET->PAUR = ENET_PAUR_PADDR2(value) | ENET_PAUR_TYPE(0x8808);
180 
181  //Set the MAC address of the station (lower 32 bits)
182  value = interface->macAddr.b[3];
183  value |= (interface->macAddr.b[2] << 8);
184  value |= (interface->macAddr.b[1] << 16);
185  value |= (interface->macAddr.b[0] << 24);
186  ENET->PALR = ENET_PALR_PADDR1(value);
187 
188  //Hash table for unicast address filtering
189  ENET->IALR = 0;
190  ENET->IAUR = 0;
191  //Hash table for multicast address filtering
192  ENET->GALR = 0;
193  ENET->GAUR = 0;
194 
195  //Disable transmit accelerator functions
196  ENET->TACC = 0;
197  //Disable receive accelerator functions
198  ENET->RACC = 0;
199 
200  //Use enhanced buffer descriptors
201  ENET->ECR = ENET_ECR_DBSWP_MASK | ENET_ECR_EN1588_MASK;
202 
203  //Reset statistics counters
204  ENET->MIBC = ENET_MIBC_MIB_CLEAR_MASK;
205  ENET->MIBC = 0;
206 
207  //Initialize buffer descriptors
208  mimxrt1060Eth1InitBufferDesc(interface);
209 
210  //Clear any pending interrupts
211  ENET->EIR = 0xFFFFFFFF;
212  //Enable desired interrupts
213  ENET->EIMR = ENET_EIMR_TXF_MASK | ENET_EIMR_RXF_MASK | ENET_EIMR_EBERR_MASK;
214 
215  //Set priority grouping (4 bits for pre-emption priority, no bits for subpriority)
216  NVIC_SetPriorityGrouping(MIMXRT1060_ETH1_IRQ_PRIORITY_GROUPING);
217 
218  //Configure ENET interrupt priority
219  NVIC_SetPriority(ENET_IRQn, NVIC_EncodePriority(MIMXRT1060_ETH1_IRQ_PRIORITY_GROUPING,
221 
222  //Enable Ethernet MAC
223  ENET->ECR |= ENET_ECR_ETHEREN_MASK;
224  //Instruct the DMA to poll the receive descriptor list
225  ENET->RDAR = ENET_RDAR_RDAR_MASK;
226 
227  //Accept any packets from the upper layer
228  osSetEvent(&interface->nicTxEvent);
229 
230  //Successful initialization
231  return NO_ERROR;
232 }
233 
234 
235 /**
236  * @brief GPIO configuration
237  * @param[in] interface Underlying network interface
238  **/
239 
240 __weak_func void mimxrt1060Eth1InitGpio(NetInterface *interface)
241 {
242 //MIMXRT1060-EVK, MIMXRT1060-EVKB or MIMXRT1064-EVK evaluation board?
243 #if defined(USE_MIMXRT1060_EVK) || defined(USE_MIMXRT1060_EVKB) || \
244  defined(USE_MIMXRT1064_EVK)
245  gpio_pin_config_t pinConfig;
246  clock_enet_pll_config_t pllConfig;
247 
248  //Configure ENET PLL (50MHz)
249  pllConfig.enableClkOutput = true;
250  pllConfig.enableClkOutput25M = false;
251  pllConfig.loopDivider = 1;
252  pllConfig.src = 0;
253  pllConfig.enableClkOutput1 = true;
254  pllConfig.loopDivider1 = 1;
255  CLOCK_InitEnetPll(&pllConfig);
256 
257  //Enable ENET1_TX_CLK output driver
258  IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, true);
259 
260  //Enable IOMUXC clock
261  CLOCK_EnableClock(kCLOCK_Iomuxc);
262 
263  //Configure GPIO_B1_04 pin as ENET_RX_DATA00
264  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_04_ENET_RX_DATA00, 0);
265 
266  //Set GPIO_B1_04 pad properties
267  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_04_ENET_RX_DATA00,
268  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
269  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
270  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
271  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
272  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
273  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
274  IOMUXC_SW_PAD_CTL_PAD_DSE(0) |
275  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
276 
277  //Configure GPIO_B1_05 pin as ENET_RX_DATA01
278  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_05_ENET_RX_DATA01, 0);
279 
280  //Set GPIO_B1_05 pad properties
281  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_05_ENET_RX_DATA01,
282  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
283  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
284  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
285  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
286  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
287  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
288  IOMUXC_SW_PAD_CTL_PAD_DSE(0) |
289  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
290 
291  //Configure GPIO_B1_06 pin as ENET_RX_EN
292  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_06_ENET_RX_EN, 0);
293 
294  //Set GPIO_B1_06 pad properties
295  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_06_ENET_RX_EN,
296  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
297  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
298  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
299  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
300  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
301  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
302  IOMUXC_SW_PAD_CTL_PAD_DSE(0) |
303  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
304 
305  //Configure GPIO_B1_07 pin as ENET_TX_DATA00
306  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_07_ENET_TX_DATA00, 0);
307 
308  //Set GPIO_B1_07 pad properties
309  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_07_ENET_TX_DATA00,
310  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
311  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
312  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
313  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
314  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
315  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
316  IOMUXC_SW_PAD_CTL_PAD_DSE(5) |
317  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
318 
319  //Configure GPIO_B1_08 pin as ENET_TX_DATA01
320  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_08_ENET_TX_DATA01, 0);
321 
322  //Set GPIO_B1_08 pad properties
323  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_08_ENET_TX_DATA01,
324  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
325  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
326  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
327  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
328  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
329  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
330  IOMUXC_SW_PAD_CTL_PAD_DSE(5) |
331  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
332 
333  //Configure GPIO_B1_09 pin as ENET_TX_EN
334  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_09_ENET_TX_EN, 0);
335 
336  //Set GPIO_B1_09 pad properties
337  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_09_ENET_TX_EN,
338  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
339  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
340  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
341  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
342  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
343  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
344  IOMUXC_SW_PAD_CTL_PAD_DSE(5) |
345  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
346 
347  //Configure GPIO_B1_10 pin as ENET_REF_CLK
348  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_10_ENET_REF_CLK, 1);
349 
350  //Set GPIO_B1_10 pad properties
351  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_10_ENET_REF_CLK,
352  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
353  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
354  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
355  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
356  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
357  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
358  IOMUXC_SW_PAD_CTL_PAD_DSE(5) |
359  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
360 
361  //Configure GPIO_B1_11 pin as ENET_RX_ER
362  IOMUXC_SetPinMux(IOMUXC_GPIO_B1_11_ENET_RX_ER, 0);
363 
364  //Set GPIO_B1_11 pad properties
365  IOMUXC_SetPinConfig(IOMUXC_GPIO_B1_11_ENET_RX_ER,
366  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
367  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
368  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
369  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
370  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
371  IOMUXC_SW_PAD_CTL_PAD_SPEED(3) |
372  IOMUXC_SW_PAD_CTL_PAD_DSE(0) |
373  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
374 
375  //Configure GPIO_EMC_40 pin as ENET_MDC
376  IOMUXC_SetPinMux(IOMUXC_GPIO_EMC_40_ENET_MDC, 0);
377 
378  //Set GPIO_EMC_40 pad properties
379  IOMUXC_SetPinConfig(IOMUXC_GPIO_EMC_40_ENET_MDC,
380  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
381  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
382  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
383  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
384  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
385  IOMUXC_SW_PAD_CTL_PAD_SPEED(0) |
386  IOMUXC_SW_PAD_CTL_PAD_DSE(5) |
387  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
388 
389  //Configure GPIO_EMC_41 pin as ENET_MDIO
390  IOMUXC_SetPinMux(IOMUXC_GPIO_EMC_41_ENET_MDIO, 0);
391 
392  //Set GPIO_EMC_41 pad properties
393  IOMUXC_SetPinConfig(IOMUXC_GPIO_EMC_41_ENET_MDIO,
394  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
395  IOMUXC_SW_PAD_CTL_PAD_PUS(2) |
396  IOMUXC_SW_PAD_CTL_PAD_PUE(1) |
397  IOMUXC_SW_PAD_CTL_PAD_PKE(1) |
398  IOMUXC_SW_PAD_CTL_PAD_ODE(1) |
399  IOMUXC_SW_PAD_CTL_PAD_SPEED(0) |
400  IOMUXC_SW_PAD_CTL_PAD_DSE(5) |
401  IOMUXC_SW_PAD_CTL_PAD_SRE(1));
402 
403  //Configure GPIO_AD_B0_09 pin as GPIO1_IO09
404  IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, 0);
405 
406  //Set GPIO_AD_B0_09 pad properties
407  IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_09_GPIO1_IO09,
408  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
409  IOMUXC_SW_PAD_CTL_PAD_PUS(0) |
410  IOMUXC_SW_PAD_CTL_PAD_PUE(0) |
411  IOMUXC_SW_PAD_CTL_PAD_PKE(0) |
412  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
413  IOMUXC_SW_PAD_CTL_PAD_SPEED(0) |
414  IOMUXC_SW_PAD_CTL_PAD_DSE(5) |
415  IOMUXC_SW_PAD_CTL_PAD_SRE(0));
416 
417  //Configure GPIO_AD_B0_10 pin as GPIO1_IO10
418  IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_10_GPIO1_IO10, 0);
419 
420  //Set GPIO_AD_B0_10 pad properties
421  IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B0_10_GPIO1_IO10,
422  IOMUXC_SW_PAD_CTL_PAD_HYS(0) |
423  IOMUXC_SW_PAD_CTL_PAD_PUS(2) |
424  IOMUXC_SW_PAD_CTL_PAD_PUE(1) |
425  IOMUXC_SW_PAD_CTL_PAD_PKE(1) |
426  IOMUXC_SW_PAD_CTL_PAD_ODE(0) |
427  IOMUXC_SW_PAD_CTL_PAD_SPEED(0) |
428  IOMUXC_SW_PAD_CTL_PAD_DSE(0) |
429  IOMUXC_SW_PAD_CTL_PAD_SRE(0));
430 
431  //Configure ENET_RST as an output
432  pinConfig.direction = kGPIO_DigitalOutput;
433  pinConfig.outputLogic = 0;
434  pinConfig.interruptMode = kGPIO_NoIntmode;
435  GPIO_PinInit(GPIO1, 9, &pinConfig);
436 
437  //Configure ENET_INT as an input
438  pinConfig.direction = kGPIO_DigitalInput;
439  pinConfig.outputLogic = 0;
440  pinConfig.interruptMode = kGPIO_NoIntmode;
441  GPIO_PinInit(GPIO1, 10, &pinConfig);
442 
443  //Reset PHY transceiver (hard reset)
444  GPIO_PinWrite(GPIO1, 9, 0);
445  sleep(10);
446  GPIO_PinWrite(GPIO1, 9, 1);
447  sleep(10);
448 #endif
449 }
450 
451 
452 /**
453  * @brief Initialize buffer descriptors
454  * @param[in] interface Underlying network interface
455  **/
456 
458 {
459  uint_t i;
460  uint32_t address;
461 
462  //Clear TX and RX buffer descriptors
463  osMemset(txBufferDesc, 0, sizeof(txBufferDesc));
464  osMemset(rxBufferDesc, 0, sizeof(rxBufferDesc));
465 
466  //Initialize TX buffer descriptors
467  for(i = 0; i < MIMXRT1060_ETH1_TX_BUFFER_COUNT; i++)
468  {
469  //Calculate the address of the current TX buffer
470  address = (uint32_t) txBuffer[i];
471  //Transmit buffer address
472  txBufferDesc[i][1] = address;
473  //Generate interrupts
474  txBufferDesc[i][2] = ENET_TBD2_INT;
475  }
476 
477  //Mark the last descriptor entry with the wrap flag
478  txBufferDesc[i - 1][0] |= ENET_TBD0_W;
479  //Initialize TX buffer index
480  txBufferIndex = 0;
481 
482  //Initialize RX buffer descriptors
483  for(i = 0; i < MIMXRT1060_ETH1_RX_BUFFER_COUNT; i++)
484  {
485  //Calculate the address of the current RX buffer
486  address = (uint32_t) rxBuffer[i];
487  //The descriptor is initially owned by the DMA
488  rxBufferDesc[i][0] = ENET_RBD0_E;
489  //Receive buffer address
490  rxBufferDesc[i][1] = address;
491  //Generate interrupts
492  rxBufferDesc[i][2] = ENET_RBD2_INT;
493  }
494 
495  //Mark the last descriptor entry with the wrap flag
496  rxBufferDesc[i - 1][0] |= ENET_RBD0_W;
497  //Initialize RX buffer index
498  rxBufferIndex = 0;
499 
500  //Start location of the TX descriptor list
501  ENET->TDSR = (uint32_t) txBufferDesc;
502  //Start location of the RX descriptor list
503  ENET->RDSR = (uint32_t) rxBufferDesc;
504  //Maximum receive buffer size
505  ENET->MRBR = MIMXRT1060_ETH1_RX_BUFFER_SIZE;
506 }
507 
508 
509 /**
510  * @brief i.MX RT1060 Ethernet MAC timer handler
511  *
512  * This routine is periodically called by the TCP/IP stack to handle periodic
513  * operations such as polling the link state
514  *
515  * @param[in] interface Underlying network interface
516  **/
517 
519 {
520  //Valid Ethernet PHY or switch driver?
521  if(interface->phyDriver != NULL)
522  {
523  //Handle periodic operations
524  interface->phyDriver->tick(interface);
525  }
526  else if(interface->switchDriver != NULL)
527  {
528  //Handle periodic operations
529  interface->switchDriver->tick(interface);
530  }
531  else
532  {
533  //Just for sanity
534  }
535 }
536 
537 
538 /**
539  * @brief Enable interrupts
540  * @param[in] interface Underlying network interface
541  **/
542 
544 {
545  //Enable Ethernet MAC interrupts
546  NVIC_EnableIRQ(ENET_IRQn);
547 
548  //Valid Ethernet PHY or switch driver?
549  if(interface->phyDriver != NULL)
550  {
551  //Enable Ethernet PHY interrupts
552  interface->phyDriver->enableIrq(interface);
553  }
554  else if(interface->switchDriver != NULL)
555  {
556  //Enable Ethernet switch interrupts
557  interface->switchDriver->enableIrq(interface);
558  }
559  else
560  {
561  //Just for sanity
562  }
563 }
564 
565 
566 /**
567  * @brief Disable interrupts
568  * @param[in] interface Underlying network interface
569  **/
570 
572 {
573  //Disable Ethernet MAC interrupts
574  NVIC_DisableIRQ(ENET_IRQn);
575 
576  //Valid Ethernet PHY or switch driver?
577  if(interface->phyDriver != NULL)
578  {
579  //Disable Ethernet PHY interrupts
580  interface->phyDriver->disableIrq(interface);
581  }
582  else if(interface->switchDriver != NULL)
583  {
584  //Disable Ethernet switch interrupts
585  interface->switchDriver->disableIrq(interface);
586  }
587  else
588  {
589  //Just for sanity
590  }
591 }
592 
593 
594 /**
595  * @brief Ethernet MAC interrupt
596  **/
597 
598 void ENET_IRQHandler(void)
599 {
600  bool_t flag;
601  uint32_t events;
602 
603  //Interrupt service routine prologue
604  osEnterIsr();
605 
606  //This flag will be set if a higher priority task must be woken
607  flag = FALSE;
608  //Read interrupt event register
609  events = ENET->EIR;
610 
611  //Packet transmitted?
612  if((events & ENET_EIR_TXF_MASK) != 0)
613  {
614  //Clear TXF interrupt flag
615  ENET->EIR = ENET_EIR_TXF_MASK;
616 
617  //Check whether the TX buffer is available for writing
618  if((txBufferDesc[txBufferIndex][0] & ENET_TBD0_R) == 0)
619  {
620  //Notify the TCP/IP stack that the transmitter is ready to send
621  flag = osSetEventFromIsr(&nicDriverInterface->nicTxEvent);
622  }
623 
624  //Instruct the DMA to poll the transmit descriptor list
625  ENET->TDAR = ENET_TDAR_TDAR_MASK;
626  }
627 
628  //Packet received?
629  if((events & ENET_EIR_RXF_MASK) != 0)
630  {
631  //Disable RXF interrupt
632  ENET->EIMR &= ~ENET_EIMR_RXF_MASK;
633 
634  //Set event flag
635  nicDriverInterface->nicEvent = TRUE;
636  //Notify the TCP/IP stack of the event
637  flag = osSetEventFromIsr(&nicDriverInterface->netContext->event);
638  }
639 
640  //System bus error?
641  if((events & ENET_EIR_EBERR_MASK) != 0)
642  {
643  //Disable EBERR interrupt
644  ENET->EIMR &= ~ENET_EIMR_EBERR_MASK;
645 
646  //Set event flag
647  nicDriverInterface->nicEvent = TRUE;
648  //Notify the TCP/IP stack of the event
649  flag |= osSetEventFromIsr(&nicDriverInterface->netContext->event);
650  }
651 
652  //Interrupt service routine epilogue
653  osExitIsr(flag);
654 }
655 
656 
657 /**
658  * @brief i.MX RT1060 Ethernet MAC event handler
659  * @param[in] interface Underlying network interface
660  **/
661 
663 {
664  error_t error;
665  uint32_t status;
666 
667  //Read interrupt event register
668  status = ENET->EIR;
669 
670  //Packet received?
671  if((status & ENET_EIR_RXF_MASK) != 0)
672  {
673  //Clear RXF interrupt flag
674  ENET->EIR = ENET_EIR_RXF_MASK;
675 
676  //Process all pending packets
677  do
678  {
679  //Read incoming packet
680  error = mimxrt1060Eth1ReceivePacket(interface);
681 
682  //No more data in the receive buffer?
683  } while(error != ERROR_BUFFER_EMPTY);
684  }
685 
686  //System bus error?
687  if((status & ENET_EIR_EBERR_MASK) != 0)
688  {
689  //Clear EBERR interrupt flag
690  ENET->EIR = ENET_EIR_EBERR_MASK;
691 
692  //Disable Ethernet MAC
693  ENET->ECR &= ~ENET_ECR_ETHEREN_MASK;
694  //Reset buffer descriptors
695  mimxrt1060Eth1InitBufferDesc(interface);
696  //Resume normal operation
697  ENET->ECR |= ENET_ECR_ETHEREN_MASK;
698  //Instruct the DMA to poll the receive descriptor list
699  ENET->RDAR = ENET_RDAR_RDAR_MASK;
700  }
701 
702  //Re-enable Ethernet MAC interrupts
703  ENET->EIMR = ENET_EIMR_TXF_MASK | ENET_EIMR_RXF_MASK | ENET_EIMR_EBERR_MASK;
704 }
705 
706 
707 /**
708  * @brief Send a packet
709  * @param[in] interface Underlying network interface
710  * @param[in] buffer Multi-part buffer containing the data to send
711  * @param[in] offset Offset to the first data byte
712  * @param[in] ancillary Additional options passed to the stack along with
713  * the packet
714  * @return Error code
715  **/
716 
718  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
719 {
720  size_t length;
721 
722  //Retrieve the length of the packet
723  length = netBufferGetLength(buffer) - offset;
724 
725  //Check the frame length
727  {
728  //The transmitter can accept another packet
729  osSetEvent(&interface->nicTxEvent);
730  //Report an error
731  return ERROR_INVALID_LENGTH;
732  }
733 
734  //Make sure the current buffer is available for writing
735  if((txBufferDesc[txBufferIndex][0] & ENET_TBD0_R) != 0)
736  {
737  return ERROR_FAILURE;
738  }
739 
740  //Copy user data to the transmit buffer
741  netBufferRead(txBuffer[txBufferIndex], buffer, offset, length);
742 
743  //Clear BDU flag
744  txBufferDesc[txBufferIndex][4] = 0;
745 
746  //Check current index
747  if(txBufferIndex < (MIMXRT1060_ETH1_TX_BUFFER_COUNT - 1))
748  {
749  //Give the ownership of the descriptor to the DMA engine
750  txBufferDesc[txBufferIndex][0] = ENET_TBD0_R | ENET_TBD0_L |
752 
753  //Point to the next buffer
754  txBufferIndex++;
755  }
756  else
757  {
758  //Give the ownership of the descriptor to the DMA engine
759  txBufferDesc[txBufferIndex][0] = ENET_TBD0_R | ENET_TBD0_W |
761 
762  //Wrap around
763  txBufferIndex = 0;
764  }
765 
766  //Data synchronization barrier
767  __DSB();
768 
769  //Instruct the DMA to poll the transmit descriptor list
770  ENET->TDAR = ENET_TDAR_TDAR_MASK;
771 
772  //Check whether the next buffer is available for writing
773  if((txBufferDesc[txBufferIndex][0] & ENET_TBD0_R) == 0)
774  {
775  //The transmitter can accept another packet
776  osSetEvent(&interface->nicTxEvent);
777  }
778 
779  //Successful processing
780  return NO_ERROR;
781 }
782 
783 
784 /**
785  * @brief Receive a packet
786  * @param[in] interface Underlying network interface
787  * @return Error code
788  **/
789 
791 {
792  error_t error;
793  size_t n;
794  NetRxAncillary ancillary;
795 
796  //Current buffer available for reading?
797  if((rxBufferDesc[rxBufferIndex][0] & ENET_RBD0_E) == 0)
798  {
799  //The frame should not span multiple buffers
800  if((rxBufferDesc[rxBufferIndex][0] & ENET_RBD0_L) != 0)
801  {
802  //Check whether an error occurred
803  if((rxBufferDesc[rxBufferIndex][0] & (ENET_RBD0_LG | ENET_RBD0_NO |
805  {
806  //Retrieve the length of the frame
807  n = rxBufferDesc[rxBufferIndex][0] & ENET_RBD0_DATA_LENGTH;
808  //Limit the number of data to read
810 
811  //Additional options can be passed to the stack along with the packet
812  ancillary = NET_DEFAULT_RX_ANCILLARY;
813 
814  //Pass the packet to the upper layer
815  nicProcessPacket(interface, rxBuffer[rxBufferIndex], n, &ancillary);
816 
817  //Valid packet received
818  error = NO_ERROR;
819  }
820  else
821  {
822  //The received packet contains an error
823  error = ERROR_INVALID_PACKET;
824  }
825  }
826  else
827  {
828  //The packet is not valid
829  error = ERROR_INVALID_PACKET;
830  }
831 
832  //Clear BDU flag
833  rxBufferDesc[rxBufferIndex][4] = 0;
834 
835  //Check current index
836  if(rxBufferIndex < (MIMXRT1060_ETH1_RX_BUFFER_COUNT - 1))
837  {
838  //Give the ownership of the descriptor back to the DMA engine
839  rxBufferDesc[rxBufferIndex][0] = ENET_RBD0_E;
840  //Point to the next buffer
841  rxBufferIndex++;
842  }
843  else
844  {
845  //Give the ownership of the descriptor back to the DMA engine
846  rxBufferDesc[rxBufferIndex][0] = ENET_RBD0_E | ENET_RBD0_W;
847  //Wrap around
848  rxBufferIndex = 0;
849  }
850 
851  //Instruct the DMA to poll the receive descriptor list
852  ENET->RDAR = ENET_RDAR_RDAR_MASK;
853  }
854  else
855  {
856  //No more data in the receive buffer
857  error = ERROR_BUFFER_EMPTY;
858  }
859 
860  //Return status code
861  return error;
862 }
863 
864 
865 /**
866  * @brief Configure MAC address filtering
867  * @param[in] interface Underlying network interface
868  * @return Error code
869  **/
870 
872 {
873  uint_t i;
874  uint_t k;
875  uint32_t crc;
876  uint32_t value;
877  uint32_t unicastHashTable[2];
878  uint32_t multicastHashTable[2];
879  MacFilterEntry *entry;
880 
881  //Debug message
882  TRACE_DEBUG("Updating MAC filter...\r\n");
883 
884  //Set the MAC address of the station (upper 16 bits)
885  value = interface->macAddr.b[5];
886  value |= (interface->macAddr.b[4] << 8);
887  ENET->PAUR = ENET_PAUR_PADDR2(value) | ENET_PAUR_TYPE(0x8808);
888 
889  //Set the MAC address of the station (lower 32 bits)
890  value = interface->macAddr.b[3];
891  value |= (interface->macAddr.b[2] << 8);
892  value |= (interface->macAddr.b[1] << 16);
893  value |= (interface->macAddr.b[0] << 24);
894  ENET->PALR = ENET_PALR_PADDR1(value);
895 
896  //Clear hash table (unicast address filtering)
897  unicastHashTable[0] = 0;
898  unicastHashTable[1] = 0;
899 
900  //Clear hash table (multicast address filtering)
901  multicastHashTable[0] = 0;
902  multicastHashTable[1] = 0;
903 
904  //The MAC address filter contains the list of MAC addresses to accept
905  //when receiving an Ethernet frame
906  for(i = 0; i < MAC_ADDR_FILTER_SIZE; i++)
907  {
908  //Point to the current entry
909  entry = &interface->macAddrFilter[i];
910 
911  //Valid entry?
912  if(entry->refCount > 0)
913  {
914  //Compute CRC over the current MAC address
915  crc = mimxrt1060Eth1CalcCrc(&entry->addr, sizeof(MacAddr));
916 
917  //The upper 6 bits in the CRC register are used to index the
918  //contents of the hash table
919  k = (crc >> 26) & 0x3F;
920 
921  //Multicast address?
922  if(macIsMulticastAddr(&entry->addr))
923  {
924  //Update the multicast hash table
925  multicastHashTable[k / 32] |= (1 << (k % 32));
926  }
927  else
928  {
929  //Update the unicast hash table
930  unicastHashTable[k / 32] |= (1 << (k % 32));
931  }
932  }
933  }
934 
935  //Write the hash table (unicast address filtering)
936  ENET->IALR = unicastHashTable[0];
937  ENET->IAUR = unicastHashTable[1];
938 
939  //Write the hash table (multicast address filtering)
940  ENET->GALR = multicastHashTable[0];
941  ENET->GAUR = multicastHashTable[1];
942 
943  //Debug message
944  TRACE_DEBUG(" IALR = 0x%08" PRIX32 "\r\n", ENET->IALR);
945  TRACE_DEBUG(" IAUR = 0x%08" PRIX32 "\r\n", ENET->IAUR);
946  TRACE_DEBUG(" GALR = 0x%08" PRIX32 "\r\n", ENET->GALR);
947  TRACE_DEBUG(" GAUR = 0x%08" PRIX32 "\r\n", ENET->GAUR);
948 
949  //Successful processing
950  return NO_ERROR;
951 }
952 
953 
954 /**
955  * @brief Adjust MAC configuration parameters for proper operation
956  * @param[in] interface Underlying network interface
957  * @return Error code
958  **/
959 
961 {
962  //Disable Ethernet MAC while modifying configuration registers
963  ENET->ECR &= ~ENET_ECR_ETHEREN_MASK;
964 
965  //10BASE-T or 100BASE-TX operation mode?
966  if(interface->linkSpeed == NIC_LINK_SPEED_100MBPS)
967  {
968  //100 Mbps operation
969  ENET->RCR &= ~ENET_RCR_RMII_10T_MASK;
970  }
971  else
972  {
973  //10 Mbps operation
974  ENET->RCR |= ENET_RCR_RMII_10T_MASK;
975  }
976 
977  //Half-duplex or full-duplex mode?
978  if(interface->duplexMode == NIC_FULL_DUPLEX_MODE)
979  {
980  //Full-duplex mode
981  ENET->TCR |= ENET_TCR_FDEN_MASK;
982  //Receive path operates independently of transmit
983  ENET->RCR &= ~ENET_RCR_DRT_MASK;
984  }
985  else
986  {
987  //Half-duplex mode
988  ENET->TCR &= ~ENET_TCR_FDEN_MASK;
989  //Disable reception of frames while transmitting
990  ENET->RCR |= ENET_RCR_DRT_MASK;
991  }
992 
993  //Reset buffer descriptors
994  mimxrt1060Eth1InitBufferDesc(interface);
995 
996  //Re-enable Ethernet MAC
997  ENET->ECR |= ENET_ECR_ETHEREN_MASK;
998  //Instruct the DMA to poll the receive descriptor list
999  ENET->RDAR = ENET_RDAR_RDAR_MASK;
1000 
1001  //Successful processing
1002  return NO_ERROR;
1003 }
1004 
1005 
1006 /**
1007  * @brief Write PHY register
1008  * @param[in] opcode Access type (2 bits)
1009  * @param[in] phyAddr PHY address (5 bits)
1010  * @param[in] regAddr Register address (5 bits)
1011  * @param[in] data Register value
1012  **/
1013 
1014 void mimxrt1060Eth1WritePhyReg(uint8_t opcode, uint8_t phyAddr,
1015  uint8_t regAddr, uint16_t data)
1016 {
1017  uint32_t temp;
1018 
1019  //Valid opcode?
1020  if(opcode == SMI_OPCODE_WRITE)
1021  {
1022  //Set up a write operation
1023  temp = ENET_MMFR_ST(1) | ENET_MMFR_OP(1) | ENET_MMFR_TA(2);
1024  //PHY address
1025  temp |= ENET_MMFR_PA(phyAddr);
1026  //Register address
1027  temp |= ENET_MMFR_RA(regAddr);
1028  //Register value
1029  temp |= ENET_MMFR_DATA(data);
1030 
1031  //Clear MII interrupt flag
1032  ENET->EIR = ENET_EIR_MII_MASK;
1033  //Start a write operation
1034  ENET->MMFR = temp;
1035 
1036  //Wait for the write to complete
1037  while((ENET->EIR & ENET_EIR_MII_MASK) == 0)
1038  {
1039  }
1040  }
1041  else
1042  {
1043  //The MAC peripheral only supports standard Clause 22 opcodes
1044  }
1045 }
1046 
1047 
1048 /**
1049  * @brief Read PHY register
1050  * @param[in] opcode Access type (2 bits)
1051  * @param[in] phyAddr PHY address (5 bits)
1052  * @param[in] regAddr Register address (5 bits)
1053  * @return Register value
1054  **/
1055 
1056 uint16_t mimxrt1060Eth1ReadPhyReg(uint8_t opcode, uint8_t phyAddr,
1057  uint8_t regAddr)
1058 {
1059  uint16_t data;
1060  uint32_t temp;
1061 
1062  //Valid opcode?
1063  if(opcode == SMI_OPCODE_READ)
1064  {
1065  //Set up a read operation
1066  temp = ENET_MMFR_ST(1) | ENET_MMFR_OP(2) | ENET_MMFR_TA(2);
1067  //PHY address
1068  temp |= ENET_MMFR_PA(phyAddr);
1069  //Register address
1070  temp |= ENET_MMFR_RA(regAddr);
1071 
1072  //Clear MII interrupt flag
1073  ENET->EIR = ENET_EIR_MII_MASK;
1074  //Start a read operation
1075  ENET->MMFR = temp;
1076 
1077  //Wait for the read to complete
1078  while((ENET->EIR & ENET_EIR_MII_MASK) == 0)
1079  {
1080  }
1081 
1082  //Get register value
1083  data = ENET->MMFR & ENET_MMFR_DATA_MASK;
1084  }
1085  else
1086  {
1087  //The MAC peripheral only supports standard Clause 22 opcodes
1088  data = 0;
1089  }
1090 
1091  //Return the value of the PHY register
1092  return data;
1093 }
1094 
1095 
1096 /**
1097  * @brief CRC calculation
1098  * @param[in] data Pointer to the data over which to calculate the CRC
1099  * @param[in] length Number of bytes to process
1100  * @return Resulting CRC value
1101  **/
1102 
1103 uint32_t mimxrt1060Eth1CalcCrc(const void *data, size_t length)
1104 {
1105  uint_t i;
1106  uint_t j;
1107  uint32_t crc;
1108  const uint8_t *p;
1109 
1110  //Point to the data over which to calculate the CRC
1111  p = (uint8_t *) data;
1112  //CRC preset value
1113  crc = 0xFFFFFFFF;
1114 
1115  //Loop through data
1116  for(i = 0; i < length; i++)
1117  {
1118  //Update CRC value
1119  crc ^= p[i];
1120 
1121  //The message is processed bit by bit
1122  for(j = 0; j < 8; j++)
1123  {
1124  if((crc & 0x01) != 0)
1125  {
1126  crc = (crc >> 1) ^ 0xEDB88320;
1127  }
1128  else
1129  {
1130  crc = crc >> 1;
1131  }
1132  }
1133  }
1134 
1135  //Return CRC value
1136  return crc;
1137 }
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
uint8_t opcode
Definition: dns_common.h:191
NXP i.MX RT1060 Ethernet MAC driver (ENET instance)
int bool_t
Definition: compiler_port.h:63
uint32_t mimxrt1060Eth1CalcCrc(const void *data, size_t length)
CRC calculation.
const NicDriver mimxrt1060Eth1Driver
i.MX RT1060 Ethernet MAC driver (ENET instance)
@ NIC_FULL_DUPLEX_MODE
Definition: nic.h:125
#define ENET_TBD0_L
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:690
#define ENET_RBD0_DATA_LENGTH
uint8_t p
Definition: ndp.h:300
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
void mimxrt1060Eth1EnableIrq(NetInterface *interface)
Enable interrupts.
#define MAC_ADDR_FILTER_SIZE
Definition: ethernet.h:95
#define TRUE
Definition: os_port.h:50
uint8_t data[]
Definition: ethernet.h:224
#define sleep(delay)
Definition: os_port.h:310
#define MIMXRT1060_ETH1_IRQ_GROUP_PRIORITY
uint_t refCount
Reference count for the current entry.
Definition: ethernet.h:266
#define ENET_TBD0_DATA_LENGTH
#define ENET_TBD0_W
#define ENET_TBD0_TC
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
Definition: nic.c:418
#define macIsMulticastAddr(macAddr)
Definition: ethernet.h:133
#define osExitIsr(flag)
#define SMI_OPCODE_WRITE
Definition: nic.h:66
#define ENET_RBD0_L
#define FALSE
Definition: os_port.h:46
error_t mimxrt1060Eth1ReceivePacket(NetInterface *interface)
Receive a packet.
void mimxrt1060Eth1DisableIrq(NetInterface *interface)
Disable interrupts.
#define MIMXRT1060_ETH1_RAM_SECTION
error_t
Error codes.
Definition: error.h:43
#define MIMXRT1060_ETH1_IRQ_SUB_PRIORITY
uint16_t mimxrt1060Eth1ReadPhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr)
Read PHY register.
void mimxrt1060Eth1WritePhyReg(uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
Write PHY register.
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
Definition: net_misc.c:103
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define txBuffer
void mimxrt1060Eth1EventHandler(NetInterface *interface)
i.MX RT1060 Ethernet MAC event handler
__weak_func void mimxrt1060Eth1InitGpio(NetInterface *interface)
GPIO configuration.
#define NetRxAncillary
Definition: net_misc.h:40
@ ERROR_INVALID_PACKET
Definition: error.h:141
#define NetInterface
Definition: net.h:40
MacAddr addr
MAC address.
Definition: ethernet.h:265
@ ERROR_INVALID_LENGTH
Definition: error.h:111
#define ENET_RBD0_W
@ ERROR_BUFFER_EMPTY
Definition: error.h:142
#define ENET_RBD0_TR
#define NetTxAncillary
Definition: net_misc.h:36
#define SMI_OPCODE_READ
Definition: nic.h:67
void mimxrt1060Eth1InitBufferDesc(NetInterface *interface)
Initialize buffer descriptors.
#define MIMXRT1060_ETH1_TX_BUFFER_COUNT
#define TRACE_INFO(...)
Definition: debug.h:105
uint8_t length
Definition: tcp.h:375
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
Definition: net_mem.c:297
void ENET_IRQHandler(void)
Ethernet MAC interrupt.
#define MIN(a, b)
Definition: os_port.h:63
error_t mimxrt1060Eth1UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
#define rxBuffer
MacAddr
Definition: ethernet.h:197
#define ENET_RBD0_LG
#define TRACE_DEBUG(...)
Definition: debug.h:119
uint16_t regAddr
#define ENET_RBD0_CR
#define MIMXRT1060_ETH1_IRQ_PRIORITY_GROUPING
#define ENET_RBD0_OV
#define ETH_MTU
Definition: ethernet.h:116
uint8_t n
error_t mimxrt1060Eth1UpdateMacConfig(NetInterface *interface)
Adjust MAC configuration parameters for proper operation.
MAC filter table entry.
Definition: ethernet.h:264
error_t mimxrt1060Eth1SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
Ipv6Addr address[]
Definition: ipv6.h:345
#define osEnterIsr()
#define MIMXRT1060_ETH1_TX_BUFFER_SIZE
#define ENET_TBD0_R
void mimxrt1060Eth1Tick(NetInterface *interface)
i.MX RT1060 Ethernet MAC timer handler
uint8_t value[]
Definition: tcp.h:376
#define MIMXRT1060_ETH1_RX_BUFFER_SIZE
#define ENET_TBD2_INT
#define ENET_RBD0_E
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
@ NIC_LINK_SPEED_100MBPS
Definition: nic.h:112
unsigned int uint_t
Definition: compiler_port.h:57
#define osMemset(p, value, length)
Definition: os_port.h:138
TCP/IP stack core.
NIC driver.
Definition: nic.h:286
error_t mimxrt1060Eth1Init(NetInterface *interface)
i.MX RT1060 Ethernet MAC initialization
#define ENET_RBD0_NO
#define ENET_RBD2_INT
@ NO_ERROR
Success.
Definition: error.h:44
__attribute__((naked))
AVR32 Ethernet MAC interrupt wrapper.
Debugging facilities.
#define MIMXRT1060_ETH1_RX_BUFFER_COUNT
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83