mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			ff_lpc546xx: add enet
fsl_phy.c/.h move to ../drivers to reuse it lwip: add hardware_init.cpull/5651/head
							parent
							
								
									eda0acc5da
								
							
						
					
					
						commit
						f6283f5b03
					
				| 
						 | 
				
			
			@ -0,0 +1,227 @@
 | 
			
		|||
/* 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 port1_pin10_config = (/* Pin is configured as ENET_TXD1 */
 | 
			
		||||
                                         IOCON_PIO_FUNC1  /* 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);
 | 
			
		||||
    /* PORT1 PIN10 (coords: E14) is configured as ENET_TXD1 */
 | 
			
		||||
     IOCON_PinMuxSet(IOCON, 1U, 10U, port1_pin10_config);                                        
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin18_config = (/* Pin is configured as ENET_PHY_RST */
 | 
			
		||||
                                         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);
 | 
			
		||||
    /* PORT1 PIN18 (coords: H11) is configured as ENET_PHY_RST */
 | 
			
		||||
    IOCON_PinMuxSet(IOCON, 1U, 18U, port1_pin18_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin14_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);
 | 
			
		||||
    /* PORT1 PIN14 (coords: B9) is configured as ENET_RX_DV */
 | 
			
		||||
    IOCON_PinMuxSet(IOCON, 1U, 14U, port1_pin14_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin12_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);
 | 
			
		||||
    /* PORT1 PIN12 (coords: A9) is configured as ENET_RXD0 */
 | 
			
		||||
    IOCON_PinMuxSet(IOCON, 1U, 12U, port1_pin12_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin13_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, 1U, 13U, port1_pin13_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin11_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, 1U, 11U, port1_pin11_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin15_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, 1U, 15U, port1_pin15_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin16_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, 1U, 16U, port1_pin16_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin17_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, 1U, 17U, port1_pin17_config);
 | 
			
		||||
 | 
			
		||||
    const uint32_t port1_pin9_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, 1U, 9U, port1_pin9_config);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -744,7 +744,6 @@
 | 
			
		|||
    "FF_LPC546XX": {
 | 
			
		||||
        "inherits": ["LPC546XX"],
 | 
			
		||||
        "extra_labels_remove" : ["LPCXpresso"],
 | 
			
		||||
        "features_remove": ["LWIP"],
 | 
			
		||||
        "supported_form_factors": [""],
 | 
			
		||||
        "detect_code": ["8081"]
 | 
			
		||||
    },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue