|
@@ -30,13 +30,22 @@
|
|
#include <netif/ethernetif.h>
|
|
#include <netif/ethernetif.h>
|
|
#include "lwipopts.h"
|
|
#include "lwipopts.h"
|
|
|
|
|
|
|
|
+#ifdef BOARD_RT1050_ATK
|
|
|
|
+ #include "drv_pcf8574.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
#define ENET_RXBD_NUM (4)
|
|
#define ENET_RXBD_NUM (4)
|
|
#define ENET_TXBD_NUM (4)
|
|
#define ENET_TXBD_NUM (4)
|
|
#define ENET_RXBUFF_SIZE (ENET_FRAME_MAX_FRAMELEN)
|
|
#define ENET_RXBUFF_SIZE (ENET_FRAME_MAX_FRAMELEN)
|
|
#define ENET_TXBUFF_SIZE (ENET_FRAME_MAX_FRAMELEN)
|
|
#define ENET_TXBUFF_SIZE (ENET_FRAME_MAX_FRAMELEN)
|
|
|
|
|
|
-#define PHY_ADDRESS 0x02u
|
|
|
|
|
|
+#if defined(BOARD_RT1050_FIRE) || defined(BOARD_RT1050_ATK)
|
|
|
|
+ #define PHY_ADDRESS 0x00u
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
+#if defined(BOARD_RT1050_EVK) || defined(BOARD_RT1050_SeeedStudio)
|
|
|
|
+ #define PHY_ADDRESS 0x02u
|
|
|
|
+#endif
|
|
/* debug option */
|
|
/* debug option */
|
|
//#define ETH_RX_DUMP
|
|
//#define ETH_RX_DUMP
|
|
//#define ETH_TX_DUMP
|
|
//#define ETH_TX_DUMP
|
|
@@ -128,8 +137,8 @@ void _enet_callback(ENET_Type *base, enet_handle_t *handle, enet_event_t event,
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-static void _enet_io_init(void)
|
|
|
|
|
|
+#if defined(BOARD_RT1050_SeeedStudio) || defined(BOARD_RT1050_EVK)
|
|
|
|
+static void evk_enet_io_init(void)
|
|
{
|
|
{
|
|
CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
|
|
CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
|
|
|
|
|
|
@@ -316,7 +325,285 @@ static void _enet_io_init(void)
|
|
Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
Hyst. Enable Field: Hysteresis Disabled */
|
|
Hyst. Enable Field: Hysteresis Disabled */
|
|
}
|
|
}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifdef BOARD_RT1050_ATK
|
|
|
|
+static void atk_enet_io_init(void)
|
|
|
|
+{
|
|
|
|
+ CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 is configured as ENET_RX_DATA00 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 is configured as ENET_RX_DATA01 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 is configured as ENET_RX_EN */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 is configured as ENET_TX_DATA00 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 is configured as ENET_TX_DATA01 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 is configured as ENET_TX_EN */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 is configured as ENET_REF_CLK */
|
|
|
|
+ 1U); /* Software Input On Field: Force input path of pad GPIO_B1_10 */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_14_ENET_MDC, /* GPIO_EMC_40 is configured as ENET_MDC */
|
|
|
|
+ 0); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_15_ENET_MDIO, /* GPIO_EMC_41 is configured as ENET_MDIO */
|
|
|
|
+ 0); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 PAD functional properties : */
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 PAD functional properties : */
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 PAD functional properties : */
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 PAD functional properties : */
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 PAD functional properties : */
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 PAD functional properties : */
|
|
|
|
+ 0x110F9);
|
|
|
|
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 PAD functional properties : */
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_14_ENET_MDC,
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_15_ENET_MDIO,
|
|
|
|
+ 0x110F9);
|
|
|
|
+
|
|
|
|
+ IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, true);
|
|
|
|
+ IOMUXC_GPR->GPR1 |= 1 << 23;
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifdef BOARD_RT1050_FIRE
|
|
|
|
+static void fire_enet_io_init(void)
|
|
|
|
+{
|
|
|
|
+ CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 is configured as GPIO1_IO09 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_10_GPIO1_IO10, /* GPIO_AD_B0_10 is configured as GPIO1_IO10 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_12_LPUART1_TX, /* GPIO_AD_B0_12 is configured as LPUART1_TX */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_13_LPUART1_RX, /* GPIO_AD_B0_13 is configured as LPUART1_RX */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_11_ENET_RX_ER, /* GPIO_B1_11 is configured as ENET_RX_ER */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 is configured as ENET_RX_DATA00 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 is configured as ENET_RX_DATA01 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 is configured as ENET_RX_EN */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 is configured as ENET_TX_DATA00 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 is configured as ENET_TX_DATA01 */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 is configured as ENET_TX_EN */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 is configured as ENET_REF_CLK */
|
|
|
|
+ 1U); /* Software Input On Field: Force input path of pad GPIO_B1_10 */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_AD_B1_04_ENET_MDC, /* GPIO_EMC_40 is configured as ENET_MDC */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+ IOMUXC_SetPinMux(
|
|
|
|
+ IOMUXC_GPIO_B1_15_ENET_MDIO, /* GPIO_EMC_41 is configured as ENET_MDIO */
|
|
|
|
+ 0U); /* Software Input On Field: Input Path is determined by functionality */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 PAD functional properties : */
|
|
|
|
+ 0xB0A9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: medium(100MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_10_GPIO1_IO10, /* GPIO_AD_B0_10 PAD functional properties : */
|
|
|
|
+ 0xB0A9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: medium(100MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_12_LPUART1_TX, /* GPIO_AD_B0_12 PAD functional properties : */
|
|
|
|
+ 0x10B0u); /* Slew Rate Field: Slow Slew Rate
|
|
|
|
+ Drive Strength Field: R0/6
|
|
|
|
+ Speed Field: medium(100MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Keeper
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Down
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_AD_B0_13_LPUART1_RX, /* GPIO_AD_B0_13 PAD functional properties : */
|
|
|
|
+ 0x10B0u); /* Slew Rate Field: Slow Slew Rate
|
|
|
|
+ Drive Strength Field: R0/6
|
|
|
|
+ Speed Field: medium(100MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Keeper
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Down
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 PAD functional properties : */
|
|
|
|
+ 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 PAD functional properties : */
|
|
|
|
+ 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 PAD functional properties : */
|
|
|
|
+ 0xB0E9u);
|
|
|
|
+ /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 PAD functional properties : */
|
|
|
|
+ 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 PAD functional properties : */
|
|
|
|
+ 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 PAD functional properties : */
|
|
|
|
+ 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 PAD functional properties : */
|
|
|
|
+ 0x31u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/6
|
|
|
|
+ Speed Field: low(50MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Disabled
|
|
|
|
+ Pull / Keep Select Field: Keeper
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Down
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_11_ENET_RX_ER, /* GPIO_B1_11 PAD functional properties : */
|
|
|
|
+ 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_AD_B1_04_ENET_MDC,
|
|
|
|
+ 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: max(200MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Disabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+
|
|
|
|
+ IOMUXC_SetPinConfig(
|
|
|
|
+ IOMUXC_GPIO_B1_15_ENET_MDIO,
|
|
|
|
+ 0xB829u); /* Slew Rate Field: Fast Slew Rate
|
|
|
|
+ Drive Strength Field: R0/5
|
|
|
|
+ Speed Field: low(50MHz)
|
|
|
|
+ Open Drain Enable Field: Open Drain Enabled
|
|
|
|
+ Pull / Keep Enable Field: Pull/Keeper Enabled
|
|
|
|
+ Pull / Keep Select Field: Pull
|
|
|
|
+ Pull Up / Down Config. Field: 100K Ohm Pull Up
|
|
|
|
+ Hyst. Enable Field: Hysteresis Disabled */
|
|
|
|
+}
|
|
|
|
+#endif
|
|
static void _enet_clk_init(void)
|
|
static void _enet_clk_init(void)
|
|
{
|
|
{
|
|
const clock_enet_pll_config_t config = {true, false, 1};
|
|
const clock_enet_pll_config_t config = {true, false, 1};
|
|
@@ -337,13 +624,22 @@ static void _enet_phy_reset_by_gpio(void)
|
|
{
|
|
{
|
|
gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
|
|
gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
|
|
|
|
|
|
|
|
+#ifndef BOARD_RT1050_ATK
|
|
GPIO_PinInit(GPIO1, 9, &gpio_config);
|
|
GPIO_PinInit(GPIO1, 9, &gpio_config);
|
|
|
|
+#endif
|
|
GPIO_PinInit(GPIO1, 10, &gpio_config);
|
|
GPIO_PinInit(GPIO1, 10, &gpio_config);
|
|
/* pull up the ENET_INT before RESET. */
|
|
/* pull up the ENET_INT before RESET. */
|
|
GPIO_WritePinOutput(GPIO1, 10, 1);
|
|
GPIO_WritePinOutput(GPIO1, 10, 1);
|
|
|
|
+
|
|
|
|
+#ifdef BOARD_RT1050_ATK
|
|
|
|
+ pcf8574_write_bit(7, 1);
|
|
|
|
+ _delay();
|
|
|
|
+ pcf8574_write_bit(7, 0);
|
|
|
|
+#else
|
|
GPIO_WritePinOutput(GPIO1, 9, 0);
|
|
GPIO_WritePinOutput(GPIO1, 9, 0);
|
|
_delay();
|
|
_delay();
|
|
GPIO_WritePinOutput(GPIO1, 9, 1);
|
|
GPIO_WritePinOutput(GPIO1, 9, 1);
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
static void _enet_config(void)
|
|
static void _enet_config(void)
|
|
@@ -656,7 +952,8 @@ static status_t _ENET_SendFrame(ENET_Type *base, enet_handle_t *handle, const ui
|
|
/* Get the current buffer descriptor address. */
|
|
/* Get the current buffer descriptor address. */
|
|
curBuffDescrip = handle->txBdCurrent[0];
|
|
curBuffDescrip = handle->txBdCurrent[0];
|
|
|
|
|
|
- } while (!(curBuffDescrip->control & ENET_BUFFDESCRIPTOR_TX_READY_MASK));
|
|
|
|
|
|
+ }
|
|
|
|
+ while (!(curBuffDescrip->control & ENET_BUFFDESCRIPTOR_TX_READY_MASK));
|
|
|
|
|
|
return kStatus_ENET_TxFrameBusy;
|
|
return kStatus_ENET_TxFrameBusy;
|
|
}
|
|
}
|
|
@@ -821,18 +1118,27 @@ static void phy_monitor_thread_entry(void *parameter)
|
|
static int rt_hw_imxrt_eth_init(void)
|
|
static int rt_hw_imxrt_eth_init(void)
|
|
{
|
|
{
|
|
rt_err_t state;
|
|
rt_err_t state;
|
|
|
|
+
|
|
|
|
+#ifdef BOARD_RT1050_ATK
|
|
|
|
+ atk_enet_io_init();
|
|
|
|
+#endif
|
|
|
|
|
|
- _enet_io_init();
|
|
|
|
- _enet_clk_init();
|
|
|
|
|
|
+#ifdef BOARD_RT1050_FIRE
|
|
|
|
+ fire_enet_io_init();
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
+#if defined(BOARD_RT1050_EVK) || defined(BOARD_RT1050_SeeedStudio)
|
|
|
|
+ evk_enet_io_init();
|
|
|
|
+#endif
|
|
|
|
+ _enet_clk_init();
|
|
/* OUI 00-80-E1 STMICROELECTRONICS. */
|
|
/* OUI 00-80-E1 STMICROELECTRONICS. */
|
|
imxrt_eth_device.dev_addr[0] = 0x00;
|
|
imxrt_eth_device.dev_addr[0] = 0x00;
|
|
imxrt_eth_device.dev_addr[1] = 0x04;
|
|
imxrt_eth_device.dev_addr[1] = 0x04;
|
|
imxrt_eth_device.dev_addr[2] = 0x9F;
|
|
imxrt_eth_device.dev_addr[2] = 0x9F;
|
|
/* generate MAC addr from 96bit unique ID (only for test). */
|
|
/* generate MAC addr from 96bit unique ID (only for test). */
|
|
imxrt_eth_device.dev_addr[3] = 0x08;
|
|
imxrt_eth_device.dev_addr[3] = 0x08;
|
|
- imxrt_eth_device.dev_addr[4] = 0x44;
|
|
|
|
- imxrt_eth_device.dev_addr[5] = 0xE5;
|
|
|
|
|
|
+ imxrt_eth_device.dev_addr[4] = 0x43;
|
|
|
|
+ imxrt_eth_device.dev_addr[5] = 0x75;
|
|
|
|
|
|
imxrt_eth_device.speed = kENET_MiiSpeed100M;
|
|
imxrt_eth_device.speed = kENET_MiiSpeed100M;
|
|
imxrt_eth_device.duplex = kENET_MiiFullDuplex;
|
|
imxrt_eth_device.duplex = kENET_MiiFullDuplex;
|
|
@@ -883,7 +1189,11 @@ static int rt_hw_imxrt_eth_init(void)
|
|
|
|
|
|
return state;
|
|
return state;
|
|
}
|
|
}
|
|
-INIT_DEVICE_EXPORT(rt_hw_imxrt_eth_init);
|
|
|
|
|
|
+#ifdef BOARD_RT1050_ATK
|
|
|
|
+ INIT_ENV_EXPORT(rt_hw_imxrt_eth_init);
|
|
|
|
+#else
|
|
|
|
+ INIT_DEVICE_EXPORT(rt_hw_imxrt_eth_init);
|
|
|
|
+#endif
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef RT_USING_FINSH
|
|
#ifdef RT_USING_FINSH
|