lab 3

Committer:
mbed_official
Date:
Thu Apr 24 10:45:51 2014 +0100
Revision:
10:ab9330955226
Synchronized with git revision 94fd2228fb4a382fb98d0115f6691fc0b659eea8

Full URL: https://github.com/mbedmicro/mbed/commit/94fd2228fb4a382fb98d0115f6691fc0b659eea8/

Currently NET_7 (HttpClient test) and NET_8 (NTP test) fail for
unknown reasons.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 10:ab9330955226 1 /*
mbed_official 10:ab9330955226 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
mbed_official 10:ab9330955226 3 * All rights reserved.
mbed_official 10:ab9330955226 4 *
mbed_official 10:ab9330955226 5 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 10:ab9330955226 6 * are permitted provided that the following conditions are met:
mbed_official 10:ab9330955226 7 *
mbed_official 10:ab9330955226 8 * o Redistributions of source code must retain the above copyright notice, this list
mbed_official 10:ab9330955226 9 * of conditions and the following disclaimer.
mbed_official 10:ab9330955226 10 *
mbed_official 10:ab9330955226 11 * o Redistributions in binary form must reproduce the above copyright notice, this
mbed_official 10:ab9330955226 12 * list of conditions and the following disclaimer in the documentation and/or
mbed_official 10:ab9330955226 13 * other materials provided with the distribution.
mbed_official 10:ab9330955226 14 *
mbed_official 10:ab9330955226 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
mbed_official 10:ab9330955226 16 * contributors may be used to endorse or promote products derived from this
mbed_official 10:ab9330955226 17 * software without specific prior written permission.
mbed_official 10:ab9330955226 18 *
mbed_official 10:ab9330955226 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mbed_official 10:ab9330955226 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mbed_official 10:ab9330955226 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 10:ab9330955226 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
mbed_official 10:ab9330955226 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mbed_official 10:ab9330955226 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 10:ab9330955226 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
mbed_official 10:ab9330955226 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed_official 10:ab9330955226 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mbed_official 10:ab9330955226 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 10:ab9330955226 29 */
mbed_official 10:ab9330955226 30
mbed_official 10:ab9330955226 31 #include "fsl_port_hal.h"
mbed_official 10:ab9330955226 32 #include "fsl_clock_manager.h"
mbed_official 10:ab9330955226 33 #include "fsl_device_registers.h"
mbed_official 10:ab9330955226 34 #include "fsl_sim_hal.h"
mbed_official 10:ab9330955226 35
mbed_official 10:ab9330955226 36 /*******************************************************************************
mbed_official 10:ab9330955226 37 * Code
mbed_official 10:ab9330955226 38 ******************************************************************************/
mbed_official 10:ab9330955226 39 void k64f_init_eth_hardware(void)
mbed_official 10:ab9330955226 40 {
mbed_official 10:ab9330955226 41 uint8_t count;
mbed_official 10:ab9330955226 42
mbed_official 10:ab9330955226 43 /* Disable the mpu*/
mbed_official 10:ab9330955226 44 BW_MPU_CESR_VLD(0);
mbed_official 10:ab9330955226 45
mbed_official 10:ab9330955226 46 /* Open POTR clock gate*/
mbed_official 10:ab9330955226 47 for (count = 0; count < HW_PORT_INSTANCE_COUNT; count++)
mbed_official 10:ab9330955226 48 {
mbed_official 10:ab9330955226 49 clock_manager_set_gate(kClockModulePORT, count, true);
mbed_official 10:ab9330955226 50 }
mbed_official 10:ab9330955226 51
mbed_official 10:ab9330955226 52 /* Configure gpio*/
mbed_official 10:ab9330955226 53 port_hal_mux_control(HW_PORTA, 12, kPortMuxAlt4); /*!< ENET RMII0_RXD1/MII0_RXD1*/
mbed_official 10:ab9330955226 54 port_hal_mux_control(HW_PORTA, 13, kPortMuxAlt4); /*!< ENET RMII0_RXD0/MII0_RXD0*/
mbed_official 10:ab9330955226 55 port_hal_mux_control(HW_PORTA, 14, kPortMuxAlt4); /*!< ENET RMII0_CRS_DV/MII0_RXDV*/
mbed_official 10:ab9330955226 56 port_hal_mux_control(HW_PORTA, 15, kPortMuxAlt4); /*!< ENET RMII0_TXEN/MII0_TXEN*/
mbed_official 10:ab9330955226 57 port_hal_mux_control(HW_PORTA, 16, kPortMuxAlt4); /*!< ENET RMII0_TXD0/MII0_TXD0*/
mbed_official 10:ab9330955226 58 port_hal_mux_control(HW_PORTA, 17, kPortMuxAlt4); /*!< ENET RMII0_TXD01/MII0_TXD1*/
mbed_official 10:ab9330955226 59 port_hal_mux_control(HW_PORTB, 0, kPortMuxAlt4); /*!< ENET RMII0_MDIO/MII0_MDIO*/
mbed_official 10:ab9330955226 60 port_hal_configure_open_drain(HW_PORTB,0, true); /*!< ENET RMII0_MDC/MII0_MDC*/
mbed_official 10:ab9330955226 61
mbed_official 10:ab9330955226 62 // Added for FRDM-K64F
mbed_official 10:ab9330955226 63 port_hal_pull_select(HW_PORTB, 0, kPortPullUp);
mbed_official 10:ab9330955226 64 port_hal_configure_pull(HW_PORTB, 0, true);
mbed_official 10:ab9330955226 65
mbed_official 10:ab9330955226 66 port_hal_mux_control(HW_PORTB, 1, kPortMuxAlt4);
mbed_official 10:ab9330955226 67 /* Configure GPIO for MII interface */
mbed_official 10:ab9330955226 68 port_hal_mux_control(HW_PORTA, 9, kPortMuxAlt4); /*!< ENET MII0_RXD3*/
mbed_official 10:ab9330955226 69 port_hal_mux_control(HW_PORTA, 10, kPortMuxAlt4); /*!< ENET MII0_RXD2*/
mbed_official 10:ab9330955226 70 port_hal_mux_control(HW_PORTA, 11, kPortMuxAlt4); /*!< ENET MII0_RXCLK*/
mbed_official 10:ab9330955226 71 port_hal_mux_control(HW_PORTA, 24, kPortMuxAlt4); /*!< ENET MII0_TXD2*/
mbed_official 10:ab9330955226 72 port_hal_mux_control(HW_PORTA, 25, kPortMuxAlt4); /*!< ENET MII0_TXCLK*/
mbed_official 10:ab9330955226 73 port_hal_mux_control(HW_PORTA, 26, kPortMuxAlt4); /*!< ENET MII0_TXD3*/
mbed_official 10:ab9330955226 74 port_hal_mux_control(HW_PORTA, 27, kPortMuxAlt4); /*!< ENET MII0_CRS*/
mbed_official 10:ab9330955226 75 port_hal_mux_control(HW_PORTA, 28, kPortMuxAlt4); /*!< ENET MII0_TXER*/
mbed_official 10:ab9330955226 76 port_hal_mux_control(HW_PORTA, 29, kPortMuxAlt4); /*!< ENET MII0_COL*/
mbed_official 10:ab9330955226 77 #if FSL_FEATURE_ENET_SUPPORT_PTP
mbed_official 10:ab9330955226 78 port_hal_mux_control(HW_PORTC, (16 + ENET_TIMER_CHANNEL_NUM), kPortMuxAlt4); /* ENET ENET0_1588_TMR0*/
mbed_official 10:ab9330955226 79 port_hal_configure_drive_strength(HW_PORTC, (16 + ENET_TIMER_CHANNEL_NUM), kPortHighDriveStrength);
mbed_official 10:ab9330955226 80 #endif
mbed_official 10:ab9330955226 81
mbed_official 10:ab9330955226 82 /* Open ENET clock gate*/
mbed_official 10:ab9330955226 83 clock_manager_set_gate(kClockModuleENET,0,true);
mbed_official 10:ab9330955226 84
mbed_official 10:ab9330955226 85 /* Select the ptp timer outclk*/
mbed_official 10:ab9330955226 86 clock_hal_set_clock_source(kSimClockTimeSrc, 2);
mbed_official 10:ab9330955226 87 }
mbed_official 10:ab9330955226 88
mbed_official 10:ab9330955226 89 /*******************************************************************************
mbed_official 10:ab9330955226 90 * EOF
mbed_official 10:ab9330955226 91 ******************************************************************************/
mbed_official 10:ab9330955226 92