/* mbed Microcontroller Library * Copyright (c) 2017 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "fsl_iocon.h" #define IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */ #define IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */ #define IOCON_PIO_FUNC1 0x01u /*!<@brief Selects pin function 1 */ #define IOCON_PIO_FUNC6 0x06u /*!<@brief Selects pin function 6 */ #define IOCON_PIO_FUNC7 0x07u /*!<@brief Selects pin function 7 */ #define IOCON_PIO_INPFILT_OFF 0x0200u /*!<@brief Input filter disabled */ #define IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */ #define IOCON_PIO_MODE_INACT 0x00u /*!<@brief No addition pin function */ #define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */ #define IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */ #define IOCON_PIO_SLEW_FAST 0x0400u /*!<@brief Fast mode, slew rate control is disabled */ #define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */ /******************************************************************************* * Code ******************************************************************************/ void lpc546xx_init_eth_hardware(void) { CLOCK_EnableClock(kCLOCK_InputMux); /* Enables the clock for the IOCON block. 0 = Disable; 1 = Enable.: 0x01u */ CLOCK_EnableClock(kCLOCK_Iocon); const uint32_t port0_pin10_config = (/* Pin is configured as SWO */ IOCON_PIO_FUNC6 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT0 PIN10 (coords: P2) is configured as SWO */ IOCON_PinMuxSet(IOCON, 0U, 10U, port0_pin10_config); const uint32_t port0_pin17_config = (/* Pin is configured as ENET_TXD1 */ IOCON_PIO_FUNC7 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT0 PIN17 (coords: E14) is configured as ENET_TXD1 */ IOCON_PinMuxSet(IOCON, 0U, 17U, port0_pin17_config); const uint32_t port0_pin29_config = (/* Pin is configured as FC0_RXD_SDA_MOSI */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Fast mode, slew rate control is disabled */ IOCON_PIO_SLEW_FAST | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT0 PIN29 (coords: B13) is configured as FC0_RXD_SDA_MOSI */ IOCON_PinMuxSet(IOCON, 0U, 29U, port0_pin29_config); const uint32_t port0_pin30_config = (/* Pin is configured as FC0_TXD_SCL_MISO */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Fast mode, slew rate control is disabled */ IOCON_PIO_SLEW_FAST | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT0 PIN30 (coords: A2) is configured as FC0_TXD_SCL_MISO */ IOCON_PinMuxSet(IOCON, 0U, 30U, port0_pin30_config); const uint32_t port2_pin26_config = (/* Pin is configured as PIO2_26 */ IOCON_PIO_FUNC0 | /* Selects pull-up function */ IOCON_PIO_MODE_PULLUP | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT2 PIN26 (coords: H11) is configured as PIO2_26 */ IOCON_PinMuxSet(IOCON, 2U, 26U, port2_pin26_config); const uint32_t port4_pin10_config = (/* Pin is configured as ENET_RX_DV */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN10 (coords: B9) is configured as ENET_RX_DV */ IOCON_PinMuxSet(IOCON, 4U, 10U, port4_pin10_config); const uint32_t port4_pin11_config = (/* Pin is configured as ENET_RXD0 */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN11 (coords: A9) is configured as ENET_RXD0 */ IOCON_PinMuxSet(IOCON, 4U, 11U, port4_pin11_config); const uint32_t port4_pin12_config = (/* Pin is configured as ENET_RXD1 */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN12 (coords: A6) is configured as ENET_RXD1 */ IOCON_PinMuxSet(IOCON, 4U, 12U, port4_pin12_config); const uint32_t port4_pin13_config = (/* Pin is configured as ENET_TX_EN */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN13 (coords: B6) is configured as ENET_TX_EN */ IOCON_PinMuxSet(IOCON, 4U, 13U, port4_pin13_config); const uint32_t port4_pin14_config = (/* Pin is configured as ENET_RX_CLK */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN14 (coords: B5) is configured as ENET_RX_CLK */ IOCON_PinMuxSet(IOCON, 4U, 14U, port4_pin14_config); const uint32_t port4_pin15_config = (/* Pin is configured as ENET_MDC */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN15 (coords: A4) is configured as ENET_MDC */ IOCON_PinMuxSet(IOCON, 4U, 15U, port4_pin15_config); const uint32_t port4_pin16_config = (/* Pin is configured as ENET_MDIO */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN16 (coords: C4) is configured as ENET_MDIO */ IOCON_PinMuxSet(IOCON, 4U, 16U, port4_pin16_config); const uint32_t port4_pin8_config = (/* Pin is configured as ENET_TXD0 */ IOCON_PIO_FUNC1 | /* No addition pin function */ IOCON_PIO_MODE_INACT | /* Input function is not inverted */ IOCON_PIO_INV_DI | /* Enables digital function */ IOCON_PIO_DIGITAL_EN | /* Input filter disabled */ IOCON_PIO_INPFILT_OFF | /* Standard mode, output slew rate control is enabled */ IOCON_PIO_SLEW_STANDARD | /* Open drain is disabled */ IOCON_PIO_OPENDRAIN_DI); /* PORT4 PIN8 (coords: B14) is configured as ENET_TXD0 */ IOCON_PinMuxSet(IOCON, 4U, 8U, port4_pin8_config); }